Skip to content

Commit ffde538

Browse files
committed
Only include npm version if npm exists
1 parent e99a7e6 commit ffde538

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

dist/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15228,8 +15228,11 @@ function run() {
1522815228
const nodeVersion = child_process_1.default.execSync(`${nodePath} --version`);
1522915229
console.log(`Node Version: ${nodeVersion}`);
1523015230
const npmPath = yield io.which('npm');
15231-
const npmVersion = child_process_1.default.execSync(`${npmPath} --version`);
15232-
console.log(`npm Version: ${npmVersion}`);
15231+
// Older versions of Node don't include npm
15232+
if (npmPath) {
15233+
const npmVersion = child_process_1.default.execSync(`${npmPath} --version`);
15234+
console.log(`npm Version: ${npmVersion}`);
15235+
}
1523315236
const registryUrl = core.getInput('registry-url');
1523415237
const alwaysAuth = core.getInput('always-auth');
1523515238
if (registryUrl) {

src/setup-node.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ async function run() {
2525
console.log(`Node Version: ${nodeVersion}`);
2626

2727
const npmPath = await io.which('npm');
28-
const npmVersion = cp.execSync(`${npmPath} --version`);
29-
console.log(`npm Version: ${npmVersion}`);
28+
// Older versions of Node don't include npm
29+
if (npmPath) {
30+
const npmVersion = cp.execSync(`${npmPath} --version`);
31+
console.log(`npm Version: ${npmVersion}`);
32+
}
3033

3134
const registryUrl: string = core.getInput('registry-url');
3235
const alwaysAuth: string = core.getInput('always-auth');

0 commit comments

Comments
 (0)