Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 
like image 450
Ashwin Hegde Avatar asked Mar 18 '13 18:03

Ashwin Hegde


People also ask

How do I run grunt locally?

Installing grunt-cli locally js method to get started with a project ( npm install && npm test ) then install grunt-cli locally with npm install grunt-cli --save-dev . Then add a script to your package. json to run the associated grunt command: "scripts": { "test": "grunt test" } .

How do I download grunt from command line?

Installing the CLI. Run sudo npm install -g grunt-cli (Windows users should omit "sudo ", and may need to run the command-line with elevated privileges). The grunt command-line interface comes with a series of options. Use grunt -h from your terminal to show these options.

How do I install grunt?

Installing a published development version Like installing a specific version of grunt, run npm install grunt@VERSION --save-dev where VERSION is the version you need, and npm will install that version of Grunt in your project folder, adding it to your package.


1 Answers

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.

like image 188
asgoth Avatar answered Oct 06 '22 04:10

asgoth