-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] config var "node-gyp
" not respected in npm 7
#2839
Comments
I tested this by "poisoning" a copy of Simply put this at the beginning of the throw new Error('hello from poisoned node-gyp') I used to be able to specify what copy of I didn't see any RFCs about this, so it's either an undocumented behavior change, or it's an oversight/bug. I'd appreciate some clarity on whether it's meant to be deprecated or dropped functionality, in which case documenting that somewhere would be great, or if it's considered a bug, some pointers on how to get the bug fixed. |
node-gyp
config var not respected in npm 7
node-gyp
config var not respected in npm 7node-gyp
" not respected in npm 7
I also find this issue, but I think it's |
@tavrez thanks for another person confirming this issue. Both variable names (with underscore or dash) can be used interchangeably, at least in npm 6.
|
I have a CI test that uses this npm config var to test whether spaces in paths can cause an issue. I would have to disable or re-write the test if we upgrade our infrastructure to use npm 7 instead of npm 6. Any thoughts on whether this might be fixed, or labelled "won'tfix", would be appreciated so I can know whether to re-write/delete the test, or just wait for the fix. Thanks. |
This is a known issue; We'll try to resolve this when we upgrade to |
I think this is an unintended consequence of npm/run-script@e4c7cb3 ? Might be the same underlying cause as what causes #3058. |
Sorry for the bump, but any progress on this issue and also #3058? I can't use Visual Studio 2022 with this, it is supported in node-gyp v8.4.0 but it is not bundled even with the latest release of npm. The only workaround for that is install node-gyp in the project locally as dev dependencies, but I can't find the reason why Yes I know this is related to npm/run-script#23 |
Any progress? |
Current Behavior:
Unlike in npm v6, the
node-gyp
config var is not respected.(This config option sets a custom path to a working
node-gyp
install'sbin/node-gyp.js
file. When set,npm
will attempt to use this copy ofnode-gyp
if executingnode-gyp
to build native C++ code.)Expected Behavior:
node-gyp
at the custom path is used. (At the path set in thenode-gyp
config var.)Steps To Reproduce:
node-gyp
(an extra copy not bundled withnpm
) and install its dependencies:i.
git clone https://github.com/nodejs/node-gyp
ii.
cd node-gyp && npm install
node-gyp
config var somehow. See the following options to do so:a) Do
npm config set node-gyp=/path/to/node-gyp/bin/node-gyp.js
b1) Do
export npm_config_node_gyp=/path/to/node-gyp/bin/node-gyp.js
(Linux/macOS)b2) Do
Set npm_config_node_gyp=C:/path/to/node-gyp/bin/node-gyp.js
(Windows)c) Use this flag with npm commands:
--node-gyp=/path/to/node-gyp/bin/node-gyp.js
npm rebuild --verbose --foreground-scripts
Note that the path of
node-gyp
is printed next to acli
label in the verbose output.For example (cli output, click to expand):
node-gyp
config var is respected, and thenode-gyp
at the custom path is used.node-gyp
config var is not respected. Regardless of the config var,node-gyp
bundled with the runningnpm
is used, OR if there is a copy ofnode-gyp
as a top-level dependency in the project'snode_modules
folder, that copy from the localnode_modules/node-gyp
is used.Environment:
Related issue?
I think I tracked down the problem to the
@npmcli/run-script
module. See this issue I created at that repository for my best guess as to why this is happening: npm/run-script#23The text was updated successfully, but these errors were encountered: