when I run npm from terminal I get this error and nothing else. no npm mand is working, all of them are giving the same error and I can't even install programs that are depending on nodejs.
$ npm module.js:557 throw err; ^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (/usr/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
at Module._pile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
when I run npm from terminal I get this error and nothing else. no npm mand is working, all of them are giving the same error and I can't even install programs that are depending on nodejs.
$ npm module.js:557 throw err; ^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (/usr/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
at Module._pile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
This did the trick for me (I'm using OSX)
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --force node
brew install node