问题
I am getting this error on sails lift.
Sails version : v0.10.0-rc11
error: Grunt :: module.js:340
throw err;
^
Error: Cannot find module '/home/mandeep/freelance/hellos/node_modules/sails/node_modules/grunt-cli/bin/grunt'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
info:
I have tried uninstalling grunt globally and then re-installing but its not working
回答1:
Looks like something got corrupted in your Sails install. In your project directory do:
npm uninstall sails
npm cache clear
npm install sails
That should fix it. A more scorched-earth approach would be:
rm -rf node_modules
npm cache clear
npm install
To make sure all of your dependencies are up to date.
回答2:
The accepted answer did not work for me; uninstalling, clearing the cache, and reinstalling did not force sails to add the necessary dependency to its node_modules (I think because I have grunt-cli installed globally). Instead I had to go into my_project_directory/node_modules/sails
and run npm install grunt-cli
See https://github.com/balderdashy/sails/issues/2059 for more explanation and hopefully some feedback or a bugfix from the sails team.
来源:https://stackoverflow.com/questions/25453807/getting-grunt-error-on-sails-lift