Node MODULE_NOT_FOUND

Leaving this here for anyone using the n nodejs version manager:

$ n 6.12.0 # Go back to a stable release
$ npm install -g npm@latest # Update npm to latest
$ n lts # Get 8.9.1
$ npm install #Should work now.

The MODULE_NOT_FOUND error seems to happen when changing between node versions and some files are possibly still being cached. I am not sure exactly but the above sequence of commands work for me.


When I first got this, I solved just running "npm install" again to make sure everything was installed.


run

rm -rf /usr/local/lib/node_modules/npm 

and then re-install Node.js will work in most cases