gruntjs / grunt-cli

Grunt's command line interface.
http://gruntjs.com/
MIT License
706 stars 248 forks source link

Errors when installing grunt-cli with npm #116

Closed Mnaaz closed 6 years ago

Mnaaz commented 6 years ago

Since today, our project is having problems when doing the npm installation of the grunt-cli. We have specificed the following versions of the grunt packages in the package.json:

"grunt": "~0.4.0", "grunt-cli": "^1.2.0"

The error that occurs, is the following:

[ERROR] module.js:327 [ERROR] throw err; [ERROR] ^ [ERROR] [ERROR] Error: Cannot find module '/myproject/node_modules/grunt-cli/bin/grunt' [ERROR] at Function.Module._resolveFilename (module.js:325:15) [ERROR] at Function.Module._load (module.js:276:25) [ERROR] at Function.Module.runMain (module.js:441:10) [ERROR] at startup (node.js:139:18) [ERROR] at node.js:974:3

Does anyone have any idea how to solve this problem? We didn't change anything.

shama commented 6 years ago

Try npm cache clear && rm -rf node_modules && npm i to clear everything out and try installing again. If it still doesn't work try updating npm i npm -g and try again.

Sometimes networks and hard disks can get into a funky state and modules get lost. If it continuously happens, start thinking about your network connection, disk repair, disk failure, etc. Or unusual environment setups that might manipulate the node_modules folder, such as Dropdox or a virtual machine managing the folder.