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

Most upvoted comments

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-builder would 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-builder wont hang here and will result in a successful build.


electron-builder: v23.0.3 node: v16.15.1 npm: v8.11.0

I have this issue too since upgrading from npm 14 to 16

Still an issue with npx

Just hit this today.

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

 execute command  command='C:\hostedtoolcache\windows\node\18.3.0\x64\node.exe' 'C:\hostedtoolcache\windows\node\18.3.0\x64\node_modules\npm\bin\npx-cli.js' rebuild --verbose bufferutil@4.0.6 utf-8-validate@5.0.9

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.

yes, that’s the same, doens’t change a thing

npm -v (If I remember it right, exec got supported since npm v7)?

“npm exec electron-builder” doesn’t work on Windows

npm exec --package=electron-builder -- electron-builder same?