Node: Cannot find module 'minimatch'

Created on 19 Nov 2015  路  7Comments  路  Source: nodejs/node

Issue: Cannot find module 'minimatch'

Identified as Node Installer, not NPM, issue. Copying from NPM Issues Repo.

https://github.com/npm/npm/issues/10449
https://github.com/npm/npm/issues/10434

upgraded node version 5x and started getting this error.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'i',
1 verbose cli '-g',
1 verbose cli 'yo' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Cannot find module 'minimatch'
4 verbose stack at Function.Module._resolveFilename (module.js:338:15)
4 verbose stack at Function.Module._load (module.js:289:25)
4 verbose stack at Module.require (module.js:366:17)
4 verbose stack at require (module.js:385:17)
4 verbose stack at Object. (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\node_modules\glob\glob.js:44:17)
4 verbose stack at Module._compile (module.js:425:26)
4 verbose stack at Object.Module._extensions..js (module.js:432:10)
4 verbose stack at Module.load (module.js:356:32)
4 verbose stack at Function.Module._load (module.js:313:12)
4 verbose stack at Module.require (module.js:366:17)
5 verbose cwd X:\cafeV2
6 error Windows_NT 6.2.9200
7 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i" "-g" "yo"
8 error node v5.1.0
9 error npm v3.3.12
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'minimatch'
12 error If you need help, you may report this error at:
12 error https://github.com/npm/npm/issues
13 verbose exit [ 1, true ]

duplicate

Most helpful comment

For mac users, remove

/usr/local/lib/node_modules/npm/node_modules/rimraf/node_modules

All 7 comments

Multiple confirmed fix:

"I was able to clear it by doing a full Node/NPM uninstall by hunting down all associated files, deleting them completely and reinstalling Node 5 from the standard link on Nodejs.org front page. I used this link for full uninstall http://benznext.com/completely-uninstall-node-js-from-mac-os-x/"

this is a dupe of #3606

Thank you for reporting though! Hopefully we'll have a fix sooner than later

I had this error after I upgraded from node 0.12.x to nodejs 5 on Windows Srv 2008 R2 via chocolatey.

Here's stack:

Error: Cannot find module 'minimatch'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\node_modules\glob\glob.js:44:17)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)

There was 'minimatch' in "C:\Program Files\nodejs\node_modules\npm\node_modules\minimatch" obviously.

To fix it I had to remove C:\Program Files\node_modules\rimraf\node_modules folder. After that npm started working.

@evil-shrike i have the same issue, but there is no such folder on my machine.

@michapixel, just copy the folder URL that ends in rimraf, as shown in ur error logs (for deletion)

For mac users, remove

/usr/local/lib/node_modules/npm/node_modules/rimraf/node_modules

For ubuntu users, removing

/usr/local/lib/node_modules/npm/node_modules/rimraf/node_modules

also works! :D

And then I followed the steps of @spelunk on this issue: https://github.com/nodejs/node/issues/9377

Copying the commands:

$ sudo n 6.
$ sudo npm install -g [email protected]
$ sudo npm install -g npm@next
$ sudo n 7.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsemozhetbyt picture vsemozhetbyt  路  3Comments

stevenvachon picture stevenvachon  路  3Comments

sandeepks1 picture sandeepks1  路  3Comments

srl295 picture srl295  路  3Comments

fanjunzhi picture fanjunzhi  路  3Comments