Skip to content

Commit 449299b

Browse files
authored
On Windows force a 32 bit build until nodejs 64 bit is supported (adobe#13384)
1 parent 7211d7f commit 449299b

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/extensibility/node/npm-installer.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,13 @@ var Errors = {
3737
* Private function to run "npm install --production" command in the extension directory.
3838
*
3939
* @param {string} installDirectory Directory to remove
40+
* @param {array} npmOptions can contain additional options like `--production` or `--proxy http://127.0.0.1:8888`
4041
* @param {function} callback NodeJS style callback to call after finish
4142
*/
4243
function _performNpmInstall(installDirectory, npmOptions, callback) {
4344
var npmPath = path.resolve(path.dirname(require.resolve("npm")), "..", "bin", "npm-cli.js");
44-
var args = [npmPath, "install"];
45-
46-
// npmOptions can contain additional args like { "production": true, "proxy": "http://127.0.0.1:8888" }
47-
Object.keys(npmOptions).forEach(function (key) {
48-
var value = npmOptions[key];
49-
if (value === true) {
50-
args.push("--" + key);
51-
} else if (typeof value === "string" && value.length > 0) {
52-
args.push("--" + key, value);
53-
}
54-
});
55-
45+
var args = [npmPath, "install"].concat(npmOptions);
46+
5647
console.log("running npm " + args.slice(1).join(" ") + " in " + installDirectory);
5748

5849
var child = spawn(process.execPath, args, { cwd: installDirectory });

src/extensibility/node/package-validator.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,20 @@ function extractAndValidateFiles(zipPath, extractDir, options, callback) {
295295
errors.push([Errors.MISSING_MAIN, zipPath, mainJS]);
296296
}
297297

298-
performNpmInstallIfRequired({
299-
production: true,
300-
proxy: options.proxy
301-
}, {
298+
var npmOptions = ['--production'];
299+
300+
if (options.proxy) {
301+
npmOptions.push('--proxy ' + options.proxy);
302+
}
303+
304+
if (process.platform.startsWith('win')) {
305+
// On Windows force a 32 bit build until nodejs 64 bit is supported.
306+
npmOptions.push('--arch=ia32');
307+
npmOptions.push('--npm_config_arch=ia32');
308+
npmOptions.push('--npm_config_target_arch=ia32');
309+
}
310+
311+
performNpmInstallIfRequired(npmOptions, {
302312
errors: errors,
303313
metadata: metadata,
304314
commonPrefix: commonPrefix,

0 commit comments

Comments
 (0)