From 790511ac518ed4a18b70bc9a56920f0269b4f20c Mon Sep 17 00:00:00 2001 From: icecream17 Date: Sat, 26 Feb 2022 16:26:23 -0600 Subject: [PATCH 1/3] Fix npm ENOENT error in install-script-runner-dependencies Despite what https://github.com/atom/atom/pull/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 https://github.com/atom-community/atom/pull/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 --- apm/package-lock.json | 6 +++--- script/config.js | 13 +++---------- script/lib/install-script-dependencies.js | 3 +-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/apm/package-lock.json b/apm/package-lock.json index 7872f163b25..069dfba288d 100644 --- a/apm/package-lock.json +++ b/apm/package-lock.json @@ -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" diff --git a/script/config.js b/script/config.js index 4fb052b4928..66ea1376bab 100644 --- a/script/config.js +++ b/script/config.js @@ -3,6 +3,7 @@ 'use strict'; +const fs = require('fs'); const path = require('path'); const spawnSync = require('./lib/spawn-sync'); @@ -111,14 +112,6 @@ function getApmBinPath() { ); } -function getNpmBinPath(external = false) { - const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm'; - const localNpmBinPath = path.resolve( - repositoryRootPath, - 'script', - 'node_modules', - '.bin', - npmBinName - ); - return localNpmBinPath; +function getNpmBinPath() { + return process.platform === 'win32' ? 'npm.cmd' : 'npm'; } diff --git a/script/lib/install-script-dependencies.js b/script/lib/install-script-dependencies.js index 11a01cd8675..bb026b35a35 100644 --- a/script/lib/install-script-dependencies.js +++ b/script/lib/install-script-dependencies.js @@ -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 } ); From ece90b3e3f2df11b1d879b0bdba1d3a20caa67ff Mon Sep 17 00:00:00 2001 From: icecream17 Date: Sat, 26 Feb 2022 16:35:23 -0600 Subject: [PATCH 2/3] Remove unused imports --- script/bootstrap | 1 - script/config.js | 1 - 2 files changed, 2 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index a25ce629ab1..7de39a8e5e6 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -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') diff --git a/script/config.js b/script/config.js index 66ea1376bab..69d5f3a2ac2 100644 --- a/script/config.js +++ b/script/config.js @@ -3,7 +3,6 @@ 'use strict'; -const fs = require('fs'); const path = require('path'); const spawnSync = require('./lib/spawn-sync'); From ee56b4ba7b96d7c0f925dc30178d6ad0b6a23b2e Mon Sep 17 00:00:00 2001 From: steven nguyen Date: Mon, 28 Feb 2022 14:44:12 +0000 Subject: [PATCH 3/3] separate getLocalNpmBinPath for install-apm.js --- script/config.js | 13 +++++++++++++ script/lib/install-apm.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/script/config.js b/script/config.js index 69d5f3a2ac2..1dca02a1f46 100644 --- a/script/config.js +++ b/script/config.js @@ -54,6 +54,7 @@ module.exports = { homeDirPath, getApmBinPath, getNpmBinPath, + getLocalNpmBinPath, snapshotAuxiliaryData: {} }; @@ -114,3 +115,15 @@ function getApmBinPath() { function getNpmBinPath() { return process.platform === 'win32' ? 'npm.cmd' : 'npm'; } + +function getLocalNpmBinPath() { + const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm'; + const localNpmBinPath = path.resolve( + repositoryRootPath, + 'script', + 'node_modules', + '.bin', + npmBinName + ); + return localNpmBinPath; +} diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index a0c20162c8a..abd882eb376 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -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 } );