Error: Cannot find module '../lib/cli'

For me npm was broken, probably because I ran it with sudo at some point.

I needed to fix brew, upgrade/update

brew uninstall node
sudo chown -R $(whoami) /usr/local/*
brew cleanup
brew install node

My solution was to just delete the directory /node_modules/ and to make a fresh install afterwards with npm install.


Nodedemon is looking for its ../lib/cli folder in its own directory and not finding it. You probably have a messed up install. This can happen sometimes when you use finder to copy a project from one folder to another.

If you blow away your node_modules directory and reinstall from scratch, you should restore the folder.

cd your_project_folder
rm -rf node_modules
npm install

Edit:

You might also use yarn.

cd your_project_folder
rm -rf node_modules
yarn

I found the fix. I had to install nodemon globally doing this: npm install nodemon -g

Tags:

Javascript

Npm