Everytime time I run npm
on mac terminal, I've got this error
Mac01:~ qa$ npm
module.js:515
throw err;
^
Error: Cannot find module 'update-notifier'
at Function.Module._resolveFilename (module.js:513:15)
at Function.Module._load (module.js:463:25)
at Module.require (module.js:556:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:29:19
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
-> http://prntscr.com/h1r3yu
how can i solve that?
Ran into this issue. Even a simple npm --version
was bombing with the same message. This lead me on a wild goose chase of brew uninstalls, symlink errors, rm's to remove files /node_modules/npm & /node, chowning directories -- you get the gist. Unsure the root cause of my brew-failings, but it might be related to npm being installed as standalone prior, whereas node now includes npm, which lead to brew config-hell on my machine.
I suggest the tips above, but if all else fails, what worked for me was to uninstall via brew, then go to the https://nodejs.org/en/download site and re-install. Believe me, I don't want to get out of terminal and not use brew, but in this case, this was the only solution that worked for me.
brew uninstall --ignore-dependencies node
or brew uninstall --force node
https://nodejs.org/en/download
download and reinstall. npm --version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With