Skip to content

Commit 6dfd680

Browse files
Add support for nodejs-mobile
1 parent 986a12f commit 6dfd680

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/util/compile.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,25 @@ const cp = require('child_process');
1010

1111
// try to build up the complete path to node-gyp
1212
/* priority:
13+
- node-gyp on ENV:NODEJS_MOBILE_GYP
1314
- node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887)
1415
- node-gyp on NODE_PATH
1516
- node-gyp inside npm on NODE_PATH (ignore on iojs)
1617
- node-gyp inside npm beside node exe
1718
*/
1819
function which_node_gyp() {
1920
let node_gyp_bin;
21+
if (process.env.NODEJS_MOBILE_GYP) {
22+
// nodejs-mobile was using npm_config_node_gyp, but that's currently being overwritten by npm 7+
23+
try {
24+
node_gyp_bin = process.env.NODEJS_MOBILE_GYP;
25+
if (existsSync(node_gyp_bin)) {
26+
return node_gyp_bin;
27+
}
28+
} catch (err) {
29+
// do nothing
30+
}
31+
}
2032
if (process.env.npm_config_node_gyp) {
2133
try {
2234
node_gyp_bin = process.env.npm_config_node_gyp;

0 commit comments

Comments
 (0)