Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] node-gyp fails to spawn (9.7.2 - 9.8.1) #6842

Closed
2 tasks done
BenAkroyd opened this issue Sep 28, 2023 · 4 comments
Closed
2 tasks done

[BUG] node-gyp fails to spawn (9.7.2 - 9.8.1) #6842

BenAkroyd opened this issue Sep 28, 2023 · 4 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@BenAkroyd
Copy link

BenAkroyd commented Sep 28, 2023

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

node fails to build, because node-gyp can't be spawned. Expect it is due to absence of bin/node-gyp-bin/node-gyp since npm 9.7.2. (bin/node-gyp-bin/node-gyp was present in 9.7.1, not 9.7.2 and after)

Expected Behavior

node-gyp is found and spawned properly

Steps To Reproduce

see nodejs/node#49737

Seperately:

-----> Installing binaries
remote:        engines.node (package.json):  18
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  unspecified (use default)
remote:
remote:        Resolving node version 18...
remote:        Downloading and installing node 18.18.0...
remote:        Using default npm version: 9.8.1
remote:        Resolving yarn version 1.22.x...
remote:        Downloading and installing yarn (1.22.19)
remote:        Installed yarn 1.22.19
remote:
remote: -----> Restoring cache
remote:        Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote:        Module installation may take longer for this build
remote:
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.22.19
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        [3/4] Linking dependencies...
remote:        [4/4] Building fresh packages...
remote:        error /tmp/build_e2530454/node_modules/deasync: Command failed.
remote:        Exit code: 1
Add npm-gyp to package.json
remote:        Command: node ./build.js
remote:        Arguments:
remote:        Directory: /tmp/build_e2530454/node_modules/deasync
remote:        Output:
remote:        node:events:495
remote:              throw er; // Unhandled 'error' event
remote:              ^
remote:
remote:        Error: spawn node-gyp ENOENT
remote:            at ChildProcess._handle.onexit (node:internal/child_process:284:19)
remote:            at onErrorNT (node:internal/child_process:477:16)
remote:            at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
remote:        Emitted 'error' event on ChildProcess instance at:
remote:            at ChildProcess._handle.onexit (node:internal/child_process:290:12)
remote:            at onErrorNT (node:internal/child_process:477:16)
remote:            at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
remote:          errno: -2,
remote:          code: 'ENOENT',
remote:          syscall: 'spawn node-gyp',
remote:          path: 'node-gyp',
remote:          spawnargs: [ 'rebuild' ]
remote:        }
remote:
remote:        Node.js v18.18.0
remote:        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Environment

  • npm: 9.8.1
  • Node.js: 18.18.0
  • OS Name: linux (heroku)
  • System Model Name:
@BenAkroyd BenAkroyd added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Sep 28, 2023
@BenAkroyd BenAkroyd changed the title [BUG] <title> [BUG] npm-gyp fails to spawn (9.7.2 and later) Sep 28, 2023
@BenAkroyd BenAkroyd changed the title [BUG] npm-gyp fails to spawn (9.7.2 and later) [BUG] npm-gyp fails to spawn (9.7.2 - 9.8.1) Sep 28, 2023
@BenAkroyd BenAkroyd changed the title [BUG] npm-gyp fails to spawn (9.7.2 - 9.8.1) [BUG] node-gyp fails to spawn (9.7.2 - 9.8.1) Sep 28, 2023
@dogawaf
Copy link

dogawaf commented Oct 3, 2023

Here, the reason was that the project still has fibers in devDependencies.
We just removed this obsolete dependency from the project.

@mima0815
Copy link

mima0815 commented Oct 5, 2023

We got hit by this issue as well, this is a breaking change and we had to implement workarounds like:

  • pinning node to 18.17.1
  • having a preinstall script in package json to install node-gyp globally "preinstall": "yarn global add node-gyp"

Was this change intended to remove node-gyp from nodejs default installs? And if yes this should not not happen in a minor or patch level change, it is breaking stuff.

Or is the general guideline to install node-gyp always globally manually?

tec27 added a commit to ShieldBattery/ShieldBattery that referenced this issue Oct 19, 2023
Seems like npm/cli#6842, so this may be fixed upstream at some point.
@wraithgar
Copy link
Member

this was fixed in the latest npm 9 and 10 releases

@sockdrawermoney
Copy link

Hi, @wraithgar! 👋 Followed a matryoshka of issues that ultimately led me to this one.

It seems something about node-gyp is unhappy in 10.2.4 but happy in 9.6.7

❯ npm i                      
-- snip --
npm ERR! gyp ERR! cwd /Users/adam/dev/framesjs-starter/node_modules/ffi-napi
npm ERR! gyp ERR! node -v v21.6.1
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/adam/.npm/_logs/2024-02-14T04_50_11_368Z-debug-0.log
~/dev/framesjs-starter via  v21.6.1 took 10s 
❯ npm --version
10.2.4
~/dev/framesjs-starter via  v21.6.1 
❯ nvm install 18.17
--- snip --- 
Now using node v18.17.1 (npm v9.6.7)
❯ npm --version
9.6.7
~/dev/framesjs-starter via  v18.17.1 
❯ npm i 

added 434 packages, and audited 435 packages in 24s

157 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
~/dev/framesjs-starter via  v18.17.1 took 24s 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests

5 participants