Skip to content

Commit

Permalink
On Windows force a 32 bit build until nodejs 64 bit is supported (ado…
Browse files Browse the repository at this point in the history
…be#13384)

(cherry picked from commit 449299b)
  • Loading branch information
ficristo committed Aug 10, 2017
1 parent ebfd28f commit 7a5ac88
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
15 changes: 3 additions & 12 deletions src/extensibility/node/npm-installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,13 @@ var Errors = {
* Private function to run "npm install --production" command in the extension directory.
*
* @param {string} installDirectory Directory to remove
* @param {array} npmOptions can contain additional options like `--production` or `--proxy http://127.0.0.1:8888`
* @param {function} callback NodeJS style callback to call after finish
*/
function _performNpmInstall(installDirectory, npmOptions, callback) {
var npmPath = path.resolve(path.dirname(require.resolve("npm")), "..", "bin", "npm-cli.js");
var args = [npmPath, "install"];

// npmOptions can contain additional args like { "production": true, "proxy": "http://127.0.0.1:8888" }
Object.keys(npmOptions).forEach(function (key) {
var value = npmOptions[key];
if (value === true) {
args.push("--" + key);
} else if (typeof value === "string" && value.length > 0) {
args.push("--" + key, value);
}
});

var args = [npmPath, "install"].concat(npmOptions);

console.log("running npm " + args.slice(1).join(" ") + " in " + installDirectory);

var child = spawn(process.execPath, args, { cwd: installDirectory });
Expand Down
18 changes: 14 additions & 4 deletions src/extensibility/node/package-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,20 @@ function extractAndValidateFiles(zipPath, extractDir, options, callback) {
errors.push([Errors.MISSING_MAIN, zipPath, mainJS]);
}

performNpmInstallIfRequired({
production: true,
proxy: options.proxy
}, {
var npmOptions = ['--production'];

if (options.proxy) {
npmOptions.push('--proxy ' + options.proxy);
}

if (process.platform.startsWith('win')) {
// On Windows force a 32 bit build until nodejs 64 bit is supported.
npmOptions.push('--arch=ia32');
npmOptions.push('--npm_config_arch=ia32');
npmOptions.push('--npm_config_target_arch=ia32');
}

performNpmInstallIfRequired(npmOptions, {
errors: errors,
metadata: metadata,
commonPrefix: commonPrefix,
Expand Down

0 comments on commit 7a5ac88

Please sign in to comment.