diff --git a/bin/npm.ps1 b/bin/npm.ps1 index 797004fd3dc42..04a1fd478ef9d 100644 --- a/bin/npm.ps1 +++ b/bin/npm.ps1 @@ -9,6 +9,7 @@ if (-not (Test-Path $NODE_EXE)) { } $NPM_PREFIX_JS="$PSScriptRoot/node_modules/npm/bin/npm-prefix.js" +$NPM_CLI_JS="$PSScriptRoot/node_modules/npm/bin/npm-cli.js" $NPM_PREFIX=(& $NODE_EXE $NPM_PREFIX_JS) if ($LASTEXITCODE -ne 0) { @@ -16,7 +17,10 @@ if ($LASTEXITCODE -ne 0) { exit 1 } -$NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js" +$NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js" +if (Test-Path $NPM_PREFIX_NPM_CLI_JS) { + $NPM_CLI_JS=$NPM_PREFIX_NPM_CLI_JS +} # Support pipeline input if ($MyInvocation.ExpectingInput) { diff --git a/bin/npx.ps1 b/bin/npx.ps1 index 01b851a82e8bb..28dae51b22ca9 100644 --- a/bin/npx.ps1 +++ b/bin/npx.ps1 @@ -9,6 +9,7 @@ if (-not (Test-Path $NODE_EXE)) { } $NPM_PREFIX_JS="$PSScriptRoot/node_modules/npm/bin/npm-prefix.js" +$NPX_CLI_JS="$PSScriptRoot/node_modules/npm/bin/npx-cli.js" $NPM_PREFIX=(& $NODE_EXE $NPM_PREFIX_JS) if ($LASTEXITCODE -ne 0) { @@ -16,7 +17,10 @@ if ($LASTEXITCODE -ne 0) { exit 1 } -$NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js" +$NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js" +if (Test-Path $NPM_PREFIX_NPX_CLI_JS) { + $NPX_CLI_JS=$NPM_PREFIX_NPX_CLI_JS +} # Support pipeline input if ($MyInvocation.ExpectingInput) { diff --git a/tap-snapshots/test/lib/commands/doctor.js.test.cjs b/tap-snapshots/test/lib/commands/doctor.js.test.cjs index 5c5b122477d81..0481c6d86823e 100644 --- a/tap-snapshots/test/lib/commands/doctor.js.test.cjs +++ b/tap-snapshots/test/lib/commands/doctor.js.test.cjs @@ -731,11 +731,11 @@ Object { "warn": Array [ String( doctor getGitPath Error: test error - doctor at which {STACK} - doctor at Doctor.getGitPath {STACK} - doctor at Doctor.exec {STACK} - doctor at processTicksAndRejections {STACK} - doctor at MockNpm.exec {STACK} + doctor at {STACK} + doctor at {STACK} + doctor at {STACK} + doctor at {STACK} + doctor at {STACK} ), ], } diff --git a/test/lib/commands/doctor.js b/test/lib/commands/doctor.js index cbe74aba53ff7..bf4ea46a918a1 100644 --- a/test/lib/commands/doctor.js +++ b/test/lib/commands/doctor.js @@ -11,7 +11,7 @@ const cleanCacheSha = (str) => str.replace(/content-v2\/sha512\/[^"]+/g, 'content-v2/sha512/{sha}') t.cleanSnapshot = p => cleanCacheSha(cleanDate(cleanCwd(p))) - .replace(/\s\((\{CWD\}|node:).*\d+:\d+\)$/gm, ' {STACK}') + .replace(/(doctor\s+at\s).*$/gm, '$1{STACK}') const npmManifest = (version) => { return {