npm / npm/cli

[BUG] npm ignores `node-gyp` config setting

Open
#9,826 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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
This is not just a request to bump a dependency for a CVE
  • This is not solely a request to bump a dependency for a CVE
Current Behavior

Observed 🔭 on the npm v11 shipped ⚓ with Node.js:

After setting npm config set node-gyp <path> to globally 🌐 installed version of node-gyp on Windows npm continues to use built-in node-gyp no matter what.

Expected Behavior

After setting npm config set node-gyp <path> to the new path npm should pick up that path to run node-dyp during execution of npm install.

Steps To Reproduce
  1. Install node-gyp globally: npm install node-gyp -g
  2. Set node-gyp global path in npm config: npm config set node-gyp $(echo "${ npm ls -g node-gyp --parseable; }\bin\node-gyp.js")
  3. Run: npm install @confluentinc\kafka-javascript --foreground-scripts --loglevel=silly
  4. See error and observe that built-in node-gyp still in use:
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli 'clean'
gyp verb cli ]
gyp info using node-gyp@12.4.0
gyp info using node@26.5.1 | win32 | x64
Environment
  • npm: 11.17.0
  • Node.js: 26.5.1
  • OS Name: Windows 11
  • System Model Name: Microsoft Windows 11 Enterprise
  • npm config:
script-shell=C:\Program Files\Git\bin\bash.exe
node-gyp=C:\Users\<redacted>\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows npm install command after setting the node-gyp config path, then trace how npm selects node-gyp during execution. Done means npm uses the configured global path instead of its built-in node-gyp, while preserving the reported install behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.