Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #23664 from icecream17/revert-npm
Browse files Browse the repository at this point in the history
Fix npm ENOENT error in install-script-runner-dependencies
  • Loading branch information
darangi committed Apr 20, 2022
2 parents 6cdc47c + ee56b4b commit 80b6c8a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions apm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion script/bootstrap
Expand Up @@ -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')
Expand Down
7 changes: 6 additions & 1 deletion script/config.js
Expand Up @@ -54,6 +54,7 @@ module.exports = {
homeDirPath,
getApmBinPath,
getNpmBinPath,
getLocalNpmBinPath,
snapshotAuxiliaryData: {}
};

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion script/lib/install-apm.js
Expand Up @@ -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 }
);
Expand Down
3 changes: 1 addition & 2 deletions script/lib/install-script-dependencies.js
Expand Up @@ -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 }
);
Expand Down

0 comments on commit 80b6c8a

Please sign in to comment.