diff --git a/scripts/generate-dev-bundle.sh b/scripts/generate-dev-bundle.sh index 6b5faae2a0..e7b84becb4 100755 --- a/scripts/generate-dev-bundle.sh +++ b/scripts/generate-dev-bundle.sh @@ -68,6 +68,15 @@ which node which npm npm version +# Make node-gyp use Node headers and libraries from $DIR/include/node. +export HOME="$DIR" +export USERPROFILE="$DIR" +export npm_config_nodedir="$DIR" + +INCLUDE_PATH="${DIR}/include/node" +echo "Contents of ${INCLUDE_PATH}:" +ls -al "$INCLUDE_PATH" + # When adding new node modules (or any software) to the dev bundle, # remember to update LICENSE.txt! Also note that we include all the # packages that these depend on, so watch out for new dependencies when @@ -115,15 +124,6 @@ cp -R node_modules/* "${DIR}/lib/node_modules/" # commands like node-gyp and node-pre-gyp. cp -R node_modules/.bin "${DIR}/lib/node_modules/" -# Make node-gyp install Node headers and libraries in $DIR/.node-gyp/. -# https://github.com/nodejs/node-gyp/blob/4ee31329e0/lib/node-gyp.js#L52 -export HOME="$DIR" -export USERPROFILE="$DIR" -node "${DIR}/lib/node_modules/node-gyp/bin/node-gyp.js" install -INCLUDE_PATH="${DIR}/.node-gyp/${NODE_VERSION}/include/node" -echo "Contents of ${INCLUDE_PATH}:" -ls -al "$INCLUDE_PATH" - cd "${DIR}/lib" # Clean up some bulky stuff. diff --git a/tools/cli/dev-bundle-bin-helpers.js b/tools/cli/dev-bundle-bin-helpers.js index 5a5bef6c3d..d0b36db9f4 100644 --- a/tools/cli/dev-bundle-bin-helpers.js +++ b/tools/cli/dev-bundle-bin-helpers.js @@ -100,8 +100,8 @@ exports.getEnv = function (options) { } // This allows node-gyp to find Node headers and libraries in - // dev_bundle/.node-gyp. - env.USERPROFILE = devBundleDir; + // dev_bundle/include/node. + env.NPM_CONFIG_NODEDIR = devBundleDir; var PATH = env.PATH || env.Path; if (PATH) {