From 8401827e14a93a89a8d6a8d892cc5946175f1d16 Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Tue, 8 Mar 2022 18:02:18 +0100 Subject: [PATCH] node: README: Add notes about XDG cache path --- node/README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/node/README.md b/node/README.md index af8440aa..06c2cca4 100644 --- a/node/README.md +++ b/node/README.md @@ -239,11 +239,28 @@ Both of these cases are handled by the electron-webpack-quick-start example. ### node-gyp and native dependencies Some node/electron versions are binary incompatible and require rebuilding of -native node dependencies for electron. In offline mode, it may result in broken ABI. -If you are seeing errors like -`The module 'something.node' was compiled against a different Node.js version`, -then pass `--electron-node-headers` option to flatpak-node-generator and set -`npm_config_nodedir` to `flatpak-node/node-gyp/electron-current`. +native node dependencies for electron. In offline mode, it may result in broken +ABI. If you are seeing errors like `The module 'something.node' was compiled +against a different Node.js version`, then pass `--electron-node-headers` +option to flatpak-node-generator and set `npm_config_nodedir` to +`flatpak-node/node-gyp/electron-current`. + +**Note**: Setting `npm_config_nodedir` should not be necessary when using XDG-compliant +cache directories layout (the default, unless disabled via `--no-xdg-layout`). + +Some tools like *electron-rebuild* don't properly respect the +XDG spec however. In this case, as a workaround, you might need to symlink the +cache directory. For example: + +```yaml +build-commands: + - | + ln -s $XDG_CACHE_HOME/node-gyp $HOME/.electron-gyp + npm run build +``` + +(Note that the build command must be ran as part of the same command as `ln`, +i.e. it won't work if you run them as separate commands.) ### ffmpeg support