diff --git a/dist/index.js b/dist/index.js index 0aeaf5e9..394eb35e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -15228,8 +15228,11 @@ function run() { const nodeVersion = child_process_1.default.execSync(`${nodePath} --version`); console.log(`Node Version: ${nodeVersion}`); const npmPath = yield io.which('npm'); - const npmVersion = child_process_1.default.execSync(`${npmPath} --version`); - console.log(`npm Version: ${npmVersion}`); + // Older versions of Node don't include npm + if (npmPath) { + const npmVersion = child_process_1.default.execSync(`${npmPath} --version`); + console.log(`npm Version: ${npmVersion}`); + } const registryUrl = core.getInput('registry-url'); const alwaysAuth = core.getInput('always-auth'); if (registryUrl) { diff --git a/src/setup-node.ts b/src/setup-node.ts index 28c106eb..b9544937 100644 --- a/src/setup-node.ts +++ b/src/setup-node.ts @@ -25,8 +25,11 @@ async function run() { console.log(`Node Version: ${nodeVersion}`); const npmPath = await io.which('npm'); - const npmVersion = cp.execSync(`${npmPath} --version`); - console.log(`npm Version: ${npmVersion}`); + // Older versions of Node don't include npm + if (npmPath) { + const npmVersion = cp.execSync(`${npmPath} --version`); + console.log(`npm Version: ${npmVersion}`); + } const registryUrl: string = core.getInput('registry-url'); const alwaysAuth: string = core.getInput('always-auth');