Quantcast
Channel: npm forum - Topics tagged triaged
Viewing all articles
Browse latest Browse all 30

'npm outdated --json' not always JSON.

$
0
0

@slime-man wrote:

What I Wanted to Do

machine parse about one thousand outdated reports. In the event that there are no outdated packages,
NPM should understand the --json bit means…i am expecting json… and should return at least a '{}' or something.

What Happened Instead

If you run npm outdated --json [--long] in a package with no outdated dependencies,
it does not write to stdout.

If someone is using --json, they are expecting json in the stdout. a zero-length string is not a valid JSON string.

Reproduction Steps

go to literally any directory with a package.json that is fully up-to-date. run npm outdated --json.

'' is not a valid json string. Mind you, '""' is, as is '{}'. But an empty string cannot be parsed as json,
though some implementations (like jq) are smart enough to figure it out.

Details

Platform Info

npm version 6.7.0

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 30

Trending Articles