Reputation: 1362
I made a horrible mistake and run this command:
sudo npm update -g npm
As a result npm was rendered useless, any attemps to install anything results in the following error :
npm ERR! Darwin 15.0.0
npm ERR! argv "/Users/michaelb/.nvm/versions/node/v5.3.0/bin/node" "/Users/michaelb/.nvm/versions/node/v5.3.0/bin/npm" "install"
npm ERR! node v5.3.0
npm ERR! npm v3.7.4
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'read-package-json'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
Can anyone speculate what is the problem and how to fix it ?
Im using OS X El Capitan (10.11)
node -v
v5.3.0
npm -v
3.7.4
nvm ls
-> v5.3.0
default -> stable (-> v5.3.0)
node -> stable (-> v5.3.0) (default)
stable -> 5.3 (-> v5.3.0) (default)
iojs -> N/A (default)
Upvotes: 2
Views: 4360
Reputation: 476
All npm issues such as :
Solution
package-lock.json
$npm upgrade
Upvotes: 0
Reputation: 148
In my case, my node was installed by the .pkg file. And I reinstall npm didn't work. I solved this problem by uninstall the node totally follow this gist: https://gist.github.com/TonyMtz/d75101d9bdf764c890ef
Upvotes: 1