Npm Cannot find 'minimatch' module

I am updating my Node.js to 5.5.0. But this does not work when I use npm.

It reports an error: Cannot find module 'minimatch' .

But Node.js version 4.2 is fine on my mac.

+6
source share
3 answers

Delete this folder /usr/local/lib/node_modules/npm/node_modules/rimraf/node_modules

 rm -rf /usr/local/lib/node_modules/npm/node_modules/rimraf/node_modules 
+9
source

This happened to me when I updated my node via a binary, but also had a previous version installed via homebrew. The way I solved this is to remove node and npm completely and reinstall using the binary found on their website.

 sudo rm /usr/local/bin/npm sudo rm /usr/local/share/man/man1/node.1 sudo rm /usr/local/lib/dtrace/node.d sudo rm -rf ~/.npm sudo rm -rf ~/.node-gyp sudo rm /opt/local/bin/node sudo rm /opt/local/include/node sudo rm -rf /opt/local/lib/node_modules brew unlink nodejs 

and reinstall.

0
source

I ran into the likelihood of the exact same problem as you.

I switched from 4.2.3 LTS to 5.9, and all npm functions stopped, always generating this error.

I needed to do the following:

  • Remove Node
  • Save anything in the Node installation folder that you can save
  • Completely remove the Node installation
  • Reinstall 5.9

After that, everything was cool. I cleared the folder after I noticed that the old installer 4.2.3 was installed in the Installer directory. I did not know what it was, but better safe than sorry.

0
source

All Articles