-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
npm/run-script
#230Labels
Bugthing that needs fixingthing that needs fixingRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release
Description
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's bin/node-gyp.js file. When set, npm will attempt to use this copy of node-gyp if executing node-gyp to build native C++ code.)
Expected Behavior:
node-gyp at the custom path is used. (At the path set in the node-gyp config var.)
Steps To Reproduce:
- If you don't have one already, obtain a copy of
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 - Specify a
node-gypconfig var somehow. See the following options to do so:
a) Donpm config set node-gyp=/path/to/node-gyp/bin/node-gyp.js
b1) Doexport npm_config_node_gyp=/path/to/node-gyp/bin/node-gyp.js(Linux/macOS)
b2) DoSet 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 - In any project that depends on a module with native code... run
npm rebuild --verbose --foreground-scripts
Note that the path of node-gyp is printed next to a cli label in the verbose output.
For example (cli output, click to expand):
gyp verb cli [
gyp verb cli '/Users/[user]/n-prefix/bin/node',
gyp verb cli '/Users/[user]/n-prefix/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild'
gyp verb cli ]
- With npm 6, the
node-gypconfig var is respected, and thenode-gypat the custom path is used. - With npm 7, the
node-gypconfig var is not respected. Regardless of the config var,node-gypbundled with the runningnpmis used, OR if there is a copy ofnode-gypas a top-level dependency in the project'snode_modulesfolder, that copy from the localnode_modules/node-gypis used.
Environment:
- OS: macOS 10.15.7
- Node: 12.4.0
- npm: 7.6.1
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#23
owl-from-hogvarts, Hazmi35 and achou11
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release