Only include npm version if npm exists

This commit is contained in:
Josh Gross 2020-04-21 11:21:23 -04:00
parent e99a7e62b2
commit ffde538781
No known key found for this signature in database
GPG key ID: 17A6308EA2144978
2 changed files with 10 additions and 4 deletions

View file

@ -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');