electron-builder: Build hangs when rebuilding native when using npx only
- Electron-Builder Version: 22.13.1
- Node Version: 16.13.0
- Electron Version: 8.5.5
- Electron Type (current, beta, nightly): current
- Target: darwin
npx electron-builder --mac
• electron-builder version=22.14.6 os=20.6.0
• loaded configuration file=package.json ("build" field)
• loaded parent configuration preset=react-cra
• writing effective config file=dist/builder-effective-config.yaml
• rebuilding native dependencies dependencies=drivelist@9.2.4 platform=darwin arch=x64
• install prebuilt binary name=drivelist version=9.2.4 platform=darwin arch=x64 napi=
• build native dependency from sources name=drivelist
version=9.2.4
platform=darwin
arch=x64
napi=
reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
error=prebuild-install info begin Prebuild-install version 5.3.6
prebuild-install WARN install prebuilt binaries enforced with --force!
prebuild-install WARN install prebuilt binaries may be out of date!
prebuild-install info looking for cached prebuild @ /Users/mifi/.npm/_prebuilds/fee87d-drivelist-v9.2.4-electron-v76-darwin-x64.tar.gz
prebuild-install http request GET https://github.com/balena-io-modules/drivelist/releases/download/v9.2.4/drivelist-v9.2.4-electron-v76-darwin-x64.tar.gz
prebuild-install http 404 https://github.com/balena-io-modules/drivelist/releases/download/v9.2.4/drivelist-v9.2.4-electron-v76-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=8.5.5 runtime=electron arch=x64 libc= platform=darwin)
…then the command hangs and never returns.
When restarting the build with DEBUG we can see this printed:
• execute command command=/node-v16.13.0-darwin-x64/bin/node /node-v16.13.0-darwin-x64/lib/node_modules/npm/bin/npx-cli.js rebuild --verbose drivelist@9.2.4
workingDirectory=
⨯ cannot execute cause=exit status 1
out=You forgot to tell me what to run when the files changes!
command=/node-v16.13.0-darwin-x64/bin/node /node-v16.13.0-darwin-x64/lib/node_modules/npm/bin/npx-cli.js rebuild --verbose drivelist@9.2.4
workingDir=
• exited command=app-builder_amd64 code=2 pid=62703
It’s trying to run npx-cli.js of the module rebuild which I think is not what is intented. So something seems to be wrong with the code trying to run npm.
Instead running this command (without npx) yields a successful result:
./node_modules/electron-builder --mac
...
• execute command command=npm rebuild --verbose drivelist@9.2.4 workingDirectory=
• command executed executable=npm
out=rebuilt dependencies successfully
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 6
- Comments: 28 (8 by maintainers)
Commits related to this issue
- fix(build): use npm exec instead of npx see https://github.com/electron-userland/electron-builder/issues/6411#issuecomment-966454664 — committed to JiPaix/Fukayo by JiPaix 2 years ago
Just encountered this today for myself. Updated node vom v12 to v16 & npm dependencies from an old project from like 2019 or so and
npx electron-builderwould hang for me after checking for prebuilds on this command:/usr/bin/node /usr/lib/node_modules/npm/bin/npx-cli.js rebuild --verbose <package1> <package2> <package3> workingDirectory=Calling
npm exec electron-builderwont hang here and will result in a successful build.electron-builder: v23.0.3node: v16.15.1npm: v8.11.0I have this issue too since upgrading from npm 14 to 16
Still an issue with npx
Just hit this today.
Root cause https://github.com/npm/cli/issues/6662 is now fixed in npm@10.1.0!
I think the root cause is https://github.com/npm/cli/issues/6662 via https://github.com/develar/app-builder/blob/4e2aa6a12e2bc3d31ec0d01d661fb3a4d65248ff/pkg/node-modules/rebuild.go#L361-L366
This has started happening to me in Github Actions after upgrade to latest on all packages.
electron-builder: v23.6.0 node: v18.3.0 npm: v8.11.0
Source: https://github.com/typerefinery-ai/typerefinery/actions/runs/4979950195/jobs/8912352154
Trying to install these packages globally.
I don’t run Windows, but I remember it worker well on GH CI Windows image/env.
npm -v(If I remember it right,execgot supported since npm v7)?npm exec --package=electron-builder -- electron-buildersame?