Merge pull request #23664 from icecream17/revert-npm

Fix npm ENOENT error in install-script-runner-dependencies
This commit is contained in:
Musa Ibrahim 2022-04-20 14:37:41 +04:00 committed by GitHub
commit 80b6c8a9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 8 deletions

6
apm/package-lock.json generated
View File

@ -72,9 +72,9 @@
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
},
"are-we-there-yet": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz",
"integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==",
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"

View File

@ -2,7 +2,6 @@
'use strict'
const path = require('path')
const CONFIG = require('./config')
const childProcess = require('child_process')
const cleanDependencies = require('./lib/clean-dependencies')

View File

@ -54,6 +54,7 @@ module.exports = {
homeDirPath,
getApmBinPath,
getNpmBinPath,
getLocalNpmBinPath,
snapshotAuxiliaryData: {}
};
@ -111,7 +112,11 @@ function getApmBinPath() {
);
}
function getNpmBinPath(external = false) {
function getNpmBinPath() {
return process.platform === 'win32' ? 'npm.cmd' : 'npm';
}
function getLocalNpmBinPath() {
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const localNpmBinPath = path.resolve(
repositoryRootPath,

View File

@ -12,7 +12,7 @@ module.exports = function(ci) {
}
console.log('Installing apm');
childProcess.execFileSync(
CONFIG.getNpmBinPath(),
CONFIG.getLocalNpmBinPath(),
['--global-style', '--loglevel=error', ci ? 'ci' : 'install'],
{ env: process.env, cwd: CONFIG.apmRootPath }
);

View File

@ -9,9 +9,8 @@ process.env.ELECTRON_CUSTOM_VERSION = CONFIG.appMetadata.electronVersion;
module.exports = function(ci) {
console.log('Installing script dependencies');
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
childProcess.execFileSync(
npmBinName,
CONFIG.getNpmBinPath(ci),
['--loglevel=error', ci ? 'ci' : 'install'],
{ env: process.env, cwd: CONFIG.scriptRootPath }
);