diff --git a/dist/setup/index.js b/dist/setup/index.js index 1b41467df..801cf3308 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -71846,8 +71846,13 @@ function run() { yield installer.getNode(version, stable, checkLatest, auth, arch); } // Output version of node is being used - const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true }); - core.setOutput('node-version', installedVersion); + try { + const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true, silent: true }); + core.setOutput('node-version', installedVersion.trim()); + } + catch (err) { + core.setOutput('node-version', ''); + } const registryUrl = core.getInput('registry-url'); const alwaysAuth = core.getInput('always-auth'); if (registryUrl) { diff --git a/src/main.ts b/src/main.ts index 5cfba617d..ac7e51f5c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -41,12 +41,16 @@ export async function run() { } // Output version of node is being used - const {stdout: installedVersion} = await exec.getExecOutput( - 'node', - ['--version'], - {ignoreReturnCode: true} - ); - core.setOutput('node-version', installedVersion); + try { + const {stdout: installedVersion} = await exec.getExecOutput( + 'node', + ['--version'], + {ignoreReturnCode: true, silent: true} + ); + core.setOutput('node-version', installedVersion.trim()); + } catch (err) { + core.setOutput('node-version', ''); + } const registryUrl: string = core.getInput('registry-url'); const alwaysAuth: string = core.getInput('always-auth');