Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

On Windows force a 32 bit build until nodejs 64 bit is supported #13384

Merged
merged 1 commit into from
Aug 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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