Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Grunt not add itself to the shell?

Tags:

macos

gruntjs

I have a problem installing grunt. All the documentation, and blog post tutorials, say that running:

npm install -g grunt 

will then allow you to run grunt commands from the terminal.

I have a situation where grunt appears to install with no errors, but typing the command grunt in the terminal still gives:

-bash: grunt: command not found 

What could I be doing wrong? And where could I find grunt to add it to my BASH profile manually?

like image 418
stephband Avatar asked Sep 21 '12 16:09

stephband


People also ask

What is npm install grunt CLI?

npm install -g grunt-cli. This will put the grunt command in your system path, allowing it to be run from any directory. 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 .

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.


1 Answers

Since Grunt version 0.4 (which was released 1 or 2 weeks ago) you need to install the grunt command line tool globally (if needed, use sudo before the command):

npm install -g grunt-cli 

In your project location you then install the latest grunt version:

npm install grunt --save-dev 

Option --save-dev will save the npm config in your package.json file, which makes it easier to install or reinstall the dependencies (using just npm install).

like image 103
asgoth Avatar answered Nov 05 '22 15:11

asgoth