Skip to content

Commit 790511a

Browse files
committed
Fix npm ENOENT error in install-script-runner-dependencies
Despite what atom#23322 is named, the pull request actually makes install-script-dependencies use the non-local npm binary. So this pr fixes install-script-runner-dependencies by making the npmBinPath consistent with install-script-dependencies ENOENT detected by #351, specifically https://dev.azure.com/atomcommunity/atomcommunity/_build/results?buildId=1132&view=logs&j=2985f0af-e798-5fdc-91b8-be9f0a3685c5&t=0a53f124-4db9-5fc3-be81-e293757effc7&l=16
1 parent 6596e0f commit 790511a

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

apm/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/config.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
'use strict';
55

6+
const fs = require('fs');
67
const path = require('path');
78
const spawnSync = require('./lib/spawn-sync');
89

@@ -111,14 +112,6 @@ function getApmBinPath() {
111112
);
112113
}
113114

114-
function getNpmBinPath(external = false) {
115-
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
116-
const localNpmBinPath = path.resolve(
117-
repositoryRootPath,
118-
'script',
119-
'node_modules',
120-
'.bin',
121-
npmBinName
122-
);
123-
return localNpmBinPath;
115+
function getNpmBinPath() {
116+
return process.platform === 'win32' ? 'npm.cmd' : 'npm';
124117
}

script/lib/install-script-dependencies.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ process.env.ELECTRON_CUSTOM_VERSION = CONFIG.appMetadata.electronVersion;
99

1010
module.exports = function(ci) {
1111
console.log('Installing script dependencies');
12-
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
1312
childProcess.execFileSync(
14-
npmBinName,
13+
CONFIG.getNpmBinPath(ci),
1514
['--loglevel=error', ci ? 'ci' : 'install'],
1615
{ env: process.env, cwd: CONFIG.scriptRootPath }
1716
);

0 commit comments

Comments
 (0)