"Fatal error: Unable to find local grunt." when running "grunt" command

gruntjs, node.js

Solution

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.

Problem

I uninstalled grunt with following command. ``` npm uninstall -g grunt ``` Then I again installed grunt with following command. ``` npm install -g grunt-cli ``` Visit following link: https://npmjs.org/package/grunt-html I want to use the above grunt plugin But when I run the grunt command it gives me following error: ``` D:\nodeJS\node_modules\grunt-html>grunt grunt-cli: The grunt command line interface. (v0.1.6) Fatal error: Unable to find local grunt. If you're seeing this message, either a Gruntfile wasn't found or grunt hasn't been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-started ```

Original source

Related problems