-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Our project uses a custom electron build.
In our .npmrc file, we specify:
electron_mirror=https://_custom_location_/electron/builds/
electron_custom_dir=v36.4.0-14
In our electron-builder.yml, we specify:
electronDownload:
mirror: https://_custom_location_/electron/builds/
customDir: v36.4.0-14
nativeRebuilder: legacy
Since electron-builder 26.0.2, the build fails with error:
gyp http GET https://_custom_location_/electron/builds/v36.4.0/node-v36.4.0-headers.tar.gz
gyp http 404 https://_custom_location_/electron/builds/v36.4.0/node-v36.4.0-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 404 response downloading https://_custom_location_/electron/builds/v36.4.0/node-v36.4.0-headers.tar.gz
gyp ERR! stack at go (/SANITIZED/.volta/tools/image/node/22.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:223:21)
gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
gyp ERR! stack at async install (/SANITIZED/.volta/tools/image/node/22.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:63:18)
gyp ERR! stack at async getNodeDir (/SANITIZED/.volta/tools/image/node/22.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:79:7)
...
Note the invalid URL https://_custom_location_/electron/builds/v36.4.0/node-v36.4.0-headers.tar.gz
When working (with 26.0.1), it downloads the correct URL https://_custom_location_/electron/builds/v36.4.0-14/electron-v36.4.0-darwin-x64.zip
I suspect #8785.
On inspection of node-gyp/lib/configure.js:79:7 and the code in app-builder-lib, it seems to be around the npm_config_disturl and not honoring the electron_custom_dir it seems (v36.4.0-14 vs v36.4.0), but might be wrong.
The difficult part is that:
- The issue for us happens only for Mac builds (not for Windows)
- It happens only in our CI builds (Jenkins) and not usually locally on my machine
- It happened only once on my local machine and then I cannot repro locally anymore
So not sure if this is some race condition or maybe something in the env vars... I will continue looking on my end to see if I can find something else but wanted to file this ticket in case you have any idea or suggestion. Thanks.
Edit: Once I deleted the ~/.electron-gyp folder on Mac, I started reproducing the issue reliably on my local Mac too. For clarity, this seems to be the folder passed here: npm_config_devdir: getElectronGypCacheDir().
I am unable to repro the issue on Windows, even when deleting the .electron-gyp, or %localappdata%\electron\Cache and some other cache folders I found.