Skip to content

Commit 8401827

Browse files
threema-danilogasinvein
authored andcommitted
node: README: Add notes about XDG cache path
1 parent 52746ec commit 8401827

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

node/README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,28 @@ Both of these cases are handled by the electron-webpack-quick-start example.
239239
### node-gyp and native dependencies
240240

241241
Some node/electron versions are binary incompatible and require rebuilding of
242-
native node dependencies for electron. In offline mode, it may result in broken ABI.
243-
If you are seeing errors like
244-
`The module 'something.node' was compiled against a different Node.js version`,
245-
then pass `--electron-node-headers` option to flatpak-node-generator and set
246-
`npm_config_nodedir` to `flatpak-node/node-gyp/electron-current`.
242+
native node dependencies for electron. In offline mode, it may result in broken
243+
ABI. If you are seeing errors like `The module 'something.node' was compiled
244+
against a different Node.js version`, then pass `--electron-node-headers`
245+
option to flatpak-node-generator and set `npm_config_nodedir` to
246+
`flatpak-node/node-gyp/electron-current`.
247+
248+
**Note**: Setting `npm_config_nodedir` should not be necessary when using XDG-compliant
249+
cache directories layout (the default, unless disabled via `--no-xdg-layout`).
250+
251+
Some tools like *electron-rebuild* don't properly respect the
252+
XDG spec however. In this case, as a workaround, you might need to symlink the
253+
cache directory. For example:
254+
255+
```yaml
256+
build-commands:
257+
- |
258+
ln -s $XDG_CACHE_HOME/node-gyp $HOME/.electron-gyp
259+
npm run build
260+
```
261+
262+
(Note that the build command must be ran as part of the same command as `ln`,
263+
i.e. it won't work if you run them as separate commands.)
247264

248265
### ffmpeg support
249266

0 commit comments

Comments
 (0)