Closed jrtitus closed 4 months ago
cc @nodejs/npm
I believe this is working as designed. npm outdated
exits with a non-zero exit code (status: 1
in the output) which causes execSync
to throw an error.
Looks like there's some discussion about the npm behaviour in https://github.com/npm/rfcs/issues/473.
@richardlau Thank you for the response.
At least now I understand how I can work around this. I didn't even consider that a non-zero exit code was expected when outdated packages are found because the command succeeds in retrieving information about them.
It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.
It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.
Version
16.20.0, 18.6.0, 20.3.0
Platform
Linux --- 5.15.90.1-microsoft-standard-WSL2 nodejs/node#1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
child_process
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always. This also occurs with a request of
execSync('npm outdated')
(without flags).What is the expected behavior? Why is that the expected behavior?
A
Buffer
including the results ofnpm outdated
.The example I'm using should have this output:
What do you see instead?
Additional information
stdout
buffer from hex to ascii, it does have the correct data, but the call fails for some reason.execSync('npm i')
,execSync('npm audit')
,execSync('npm config list --json')
, etc. will succeed.