2

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)
2
  • Have you tried to run it with sudo? Commented Feb 22, 2016 at 5:24
  • yes, i get the same error using "sudo npm install" Commented Feb 22, 2016 at 5:25

3 Answers 3

1

Just found in their GitHub issues

Reference:

Solution: Reinstall npm

Sign up to request clarification or add additional context in comments.

1 Comment

I ended up doing just that, my npm was installed through nvm mv ~/.nvm/ ~/.nvm-bkp; nvm install 5.3.0
1

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

Comments

0

All npm issues such as :


  • Error: Cannot find module 'interpret'
  • Error: Cannot find module 'read-pkg-up'
  • Error: Cannot find module 'lru-cache'

Solution


  1. Delete file :

package-lock.json

  1. Run in the terminal

$npm upgrade

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.