"npm outdated" will mark packages for update if a wrong formatted package.json is used

cli
help-wanted
priority:low
triaged

(Redwolf) #1

What I Wanted to Do

Check if there are outdated packages.

What Happened Instead

There were packages marked for update that shouldn’t be updated.

Reproduction Steps

Replace the last } with }foobar at the end of your package.json in order to create a wrong formatted package.json

Details

If you ran npm outdated on an invalid package.json, it wants to update packages to the latest version. Instead it should just state, that the package.json is in an invalid format, where and why.

Platform Info

NPM 6.2

With an Ionic 3 project

Here you can see such a behavior:

First command was done with an invalid package.json.
Second command was done with a valid package.json.


npm install removes all other packages if dependencies in package.json is an array instead of an object.
(system) #2

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.