"Fatal error: Unable to find local grunt." when running "grunt" command
All is explained quite nicely on gruntjs.com.
Note that installing grunt-cli does not install the grunt task runner! The job of the grunt CLI is simple: run the version of grunt which has been installed next to a Gruntfile. This allows multiple versions of grunt to be installed on the same machine simultaneously.
So in your project folder, you will need to install (preferably) the latest grunt version:
npm install grunt --save-dev
Option --save-dev
will add grunt
as a dev-dependency to your package.json. This makes it easy to reinstall dependencies.
You have to install grunt in your project folder
-
create your package.json
$ npm init
-
install grunt for this project, this will be installed under
node_modules/
. --save-dev will add this module to devDependency in your package.json$ npm install grunt --save-dev
-
then create gruntfile.js and run
$ grunt
I think you have to add grunt to your package.json
file. See this link.