I know this an old question but I've been strugging with a similar issue and figure I'd at least add what worked for me...
Problem
Running npm list -g
lists all packages as expected and then throws a variety of errors including the missing errors, as mentioned above, and, for me at least, a bunch of invalid and extraneous errors such as this:
extraneous: aws-sign2@0.5.0 /usr/local/lib/node_modules/npm/node_modules/aws-sign2
I tried a bunch of solutions including npm upgrade
, npm prune
, as well as installing missing packages, which for me was semver:
missing: semver@2 || 3, required by normalize-package-data@1.0.1
I'm still not sure of the exact cause for these errors, though I believe this happened when I upgraded to 3.3.6.
Solution
After some headache I ran:
npm update -g --verbose
which upgraded me from v3.3.6 to v3.5.3 and got rid of all the errors. Note that the --verbose
is not necessary but helpful to see what exactly is happening. Now my npm list -g
returns a clean output:
/usr/local/lib
├── npm@3.5.3
└── semver@2.3.2
Hope this helps someone, please comment if I've stated any inaccuracies or if there's something I can add here.