Last Updated: February 25, 2016
·
2.443K
· marius_stuparu

npm won't run after update (Linux)

This just hapened to me, and I'm writing this for anyone who may need it.

After doing a global update on my CentOS machine with

npm update -g

I got this error:

/usr/local/bin/npm: No such file or directory

The symlink in /usr/local/bin was broken, but copying it from /usr/bin did not work, npm throwing this error:

Cannot find module '../lib/npm.js'

So, the solution was to:

  1. Remove everything from ~/.npm
  2. Re-install npm with curl http://npmjs.org/install.sh | sh
  3. Re-build the hash database hash -r