question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build hangs when rebuilding native when using npx only

See original GitHub issue
  • 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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
RicoBrasecommented, Jun 20, 2022

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

3reactions
mificommented, Apr 16, 2022

Still an issue with npx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix npx create-react-app stuck or hangs when installing or ...
I have encountered this scenario a few times during installation of create-react-app or when installing react dependencies.
Read more >
I can't install react using npx create-react-app? - Stack Overflow
This happens is if one of the node modules requires to install your react app is missing. The other reason is if your...
Read more >
Expo CLI - Expo Documentation
Build and run the native apps locally: npx expo run:ios and npx expo ... You can change this behavior to localhost-only by using...
Read more >
Error Codes | Yarn - Package Manager
The author of packageA can fix this problem by adding a peer dependency on packagePeer . If relevant, they can use optional peer...
Read more >
Fixing React-Native android release build - wesionaryTEAM
Using Logcat CLI to determine the issue · adb logcat '*:E' · project.ext.react = [ enableHermes: true, // clean and rebuild if changing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found