-
Notifications
You must be signed in to change notification settings - Fork 23
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] The npm_config_node_gyp
environment variable and npm config set node-gyp
config don't work with npm 7
#23
Comments
npm_config_node_gyp
environment variable and npm config set node-gyp
config don't work with npm 7 (seems to be hard-coded by accident?)npm_config_node_gyp
environment variable and npm config set node-gyp
config don't work with npm 7
I think this commit e4c7cb3 is the cause. I think it is also the cause of the bugs I posted at |
Any updates on this issue? I just run into this issue. This should be fixed, I need to use Visual Studio 2022, but node-gyp only supports it on v8.4.0, meanwhile, the bundled version from npm is only v8.2.0. |
What / Why
I have been trying to test npm 7 with the
npm_config_node_gyp
env var set, or doingnpm config set node-gyp=some_path
. It isn't working. I believe I've traced back the problem to a basically hard-coded value here:run-script/lib/make-spawn-args.js
Line 5 in f976fd3
By the way: Editing that (probably too simplistically) to the following makes it configurable again with the env var:
When
Any time I try to use a custom location of
node-gyp
with thenpm_config_node_gyp
env var or after doingnpm config set node-gyp=path/to/node-gyp/bin/node-gyp.js
with npm 7.Where
Any
npm
command I run that should runnode-gyp
to rebuild native code is affected.How
Current Behavior
npm 7 always always runs its built-in copy of
node-gyp
. (Or, if there is a copy ofnode-gyp
as a top-level dependency in the current project'snode_modules
folder, that copy from the localnode_modules/node-gyp
folder is used.)Steps to Reproduce
Set up a project with native C++ code somewhere in the dependencies and try to get
npm
to runnode-gyp
on it. Example steps below, and example output below that:node-gyp
to your computer somewhere, install its dependenciesnpm_config_node_gyp
to/path/to/node-gyp/bin/node-gyp.js
.npm config set npm-config=/path/to/node-gyp/bin/node-gyp.js
mkdir x && cd x && npm init -y && npm install [some package that needs to build native C++ code]
npm ci --verbose --foreground-scripts
to see verbose output, including the pathnode-gyp
is at.Relevant bit of the verbose output (click to expand):
The built-in
node-gyp
path:If you manage to customize the path to
node-gyp
:Expected Behavior
Who
References
The text was updated successfully, but these errors were encountered: