Current Behavior:
Running npm ls --json with missing dependencies outputs the error to stdout instead of stderr. This creates two top-level JSON objects, making it unparseable.
This is a regression from v6.
May be related to: #1109
Expected Behavior:
Normal output should print to stdout, errors should print to stderr.
i.e.
stdout:
{
"name": "temp",
"problems": [
"missing: foo@1.0.0, required by temp@"
],
"dependencies": {
"foo": {
"required": "1.0.0",
"missing": true,
"problems": [
"missing: foo@1.0.0, required by temp@"
]
}
}
}
stderr:
{
"error": {
"code": "ELSPROBLEMS",
"summary": "missing: foo@1.0.0, required by temp@",
"detail": ""
}
}
Steps To Reproduce:
For the life of me I can't figure out why this test passes, as it clearly asserts the expected stdout.
That said, I can reproduce the issue running the cli manually on a simple package.json:
$ mkdir issue-2150 && cd issue-2150
$ echo '{ "dependencies": { "foo": "1.0.0" } }' > package.json
$ npm ls --json 2>/dev/null
2>/dev/null makes it clear that the following output is all on stdout:
{
"name": "temp",
"problems": [
"missing: foo@1.0.0, required by temp@"
],
"dependencies": {
"foo": {
"required": "1.0.0",
"missing": true,
"problems": [
"missing: foo@1.0.0, required by temp@"
]
}
}
}
{
"error": {
"code": "ELSPROBLEMS",
"summary": "missing: foo@1.0.0, required by temp@",
"detail": ""
}
}
Environment:
OS: 10.14.6
Node: 15.1.0
npm: 7.0.9
Current Behavior:
Running
npm ls --jsonwith missing dependencies outputs the error tostdoutinstead ofstderr. This creates two top-level JSON objects, making it unparseable.This is a regression from
v6.May be related to: #1109
Expected Behavior:
Normal output should print to
stdout, errors should print tostderr.i.e.
stdout:{ "name": "temp", "problems": [ "missing: foo@1.0.0, required by temp@" ], "dependencies": { "foo": { "required": "1.0.0", "missing": true, "problems": [ "missing: foo@1.0.0, required by temp@" ] } } }stderr:{ "error": { "code": "ELSPROBLEMS", "summary": "missing: foo@1.0.0, required by temp@", "detail": "" } }Steps To Reproduce:
For the life of me I can't figure out why this test passes, as it clearly asserts the expected
stdout.That said, I can reproduce the issue running the cli manually on a simple package.json:
2>/dev/nullmakes it clear that the following output is all onstdout:{ "name": "temp", "problems": [ "missing: foo@1.0.0, required by temp@" ], "dependencies": { "foo": { "required": "1.0.0", "missing": true, "problems": [ "missing: foo@1.0.0, required by temp@" ] } } } { "error": { "code": "ELSPROBLEMS", "summary": "missing: foo@1.0.0, required by temp@", "detail": "" } }Environment:
OS: 10.14.6
Node: 15.1.0
npm: 7.0.9