File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint camelcase: "off" */
2
2
const setPATH = require ( './set-path.js' )
3
3
const { resolve } = require ( 'path' )
4
- const npm_config_node_gyp = require . resolve ( 'node-gyp/bin/node-gyp.js' )
5
4
6
5
const makeSpawnArgs = options => {
7
6
const {
@@ -14,16 +13,28 @@ const makeSpawnArgs = options => {
14
13
cmd,
15
14
args,
16
15
stdioString,
16
+ nodeGyp,
17
17
} = options
18
18
19
+ if ( nodeGyp ) {
20
+ // npm already pulled this from env and passes it in to options
21
+ npm_config_node_gyp = nodeGyp
22
+ } else if ( env . npm_config_node_gyp ) {
23
+ // legacy mode for standalone user
24
+ npm_config_node_gyp = env . npm_config_node_gyp
25
+ } else {
26
+ // default
27
+ npm_config_node_gyp = require . resolve ( 'node-gyp/bin/node-gyp.js' )
28
+ }
29
+
19
30
const spawnEnv = setPATH ( path , binPaths , {
20
31
// we need to at least save the PATH environment var
21
32
...process . env ,
22
33
npm_package_json : resolve ( path , 'package.json' ) ,
23
34
npm_lifecycle_event : event ,
24
35
npm_lifecycle_script : cmd ,
25
- npm_config_node_gyp,
26
36
...env ,
37
+ npm_config_node_gyp,
27
38
} )
28
39
29
40
const spawnOpts = {
You can’t perform that action at this time.
0 commit comments