Skip to content


Subversion checkout URL

You can clone with
Download ZIP


npm outputs invalid json #1925

DavidIAm opened this Issue · 5 comments

4 participants


Json spec:

A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes.

When I execute commands like npm view, the output is not dissimilar from json - it might even be javascript - but what it is definitely NOT is JSON.

The output of this command is hence useless for automation. Surely it would not be difficult to use a standard pretty-printer to output this information in legal JSON notation?


"npm info" is the command I was speaking of.

It would be nice if there was a way to interact with npm in a parseable api way. Its nice to not have to reengineer npm's capabilities when they're already implimented so nicely.

I suppose in the end it would end up splitting npm into controller/view sections and having an api view and a CLI view...


The output of npm view is also not really JSON. It ignores the --json option.


+1. I have some use cases where node view|info outputting valid json would make my life much easier.

@isaacs isaacs closed this in 89bd086

info and view are the same command, btw. Will be fixed in 1.1.62.


Er, 1.1.63.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.