Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
run any command with --json
and a 404
response:
$ npm --json show foobar@0.0.0 2> stderr.txt 1> stdout.txt
all the content is on stderr:
$ cat stderr.txt
npm ERR! code E404
npm ERR! 404 No match found for version 0.0.0
npm ERR! 404
npm ERR! 404 'foobar@0.0.0' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
{
"error": {
"code": "E404",
"summary": "No match found for version 0.0.0",
"detail": "\n 'foobar@0.0.0' is not in this registry.\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
}
}
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ahmad/.npm/_logs/2022-08-10T02_39_53_304Z-debug-0.log
empty result on stdout:
$ cat stdout.txt
Expected Behavior
the json object should be written to stdout:
$ npm --json show foobar@0.0.0 2> stderr.txt 1> stdout.txt
$ cat stderr.txt
npm ERR! code E404
npm ERR! 404 No match found for version 0.0.0
npm ERR! 404
npm ERR! 404 'foobar@0.0.0' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ahmad/.npm/_logs/2022-08-10T02_39_53_304Z-debug-0.log
$ cat stdout.txt
{
"error": {
"code": "E404",
"summary": "No match found for version 0.0.0",
"detail": "\n 'foobar@0.0.0' is not in this registry.\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
}
}
Steps To Reproduce
see above
Environment
- npm: 8.15.0