Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt: command not found when running from terminal

Tags:

gruntjs

I'm new to Grunt. I'm trying to configure Grunt on my Mac OSX Lion.

I followed the instructions here and then created a project folder that contains the files below. When I try to run by typing "grunt" into terminal I get command not found. I've also modified my paths sudo nano /etc/paths in the hope that adding the path would make the task runner work but it's still not working. Can someone assist with this please?

---paths  /usr/bin  /bin /usr/sbin /sbin /usr/local/bin /usr/local/bin/grunt   --- files node modules Gruntfile.js package.json 
like image 317
user686483 Avatar asked Jun 01 '13 04:06

user686483


People also ask

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.


2 Answers

My fix for this on Mountain Lion was: -

npm install -g grunt-cli  

Saw it on http://gruntjs.com/getting-started

like image 51
user2792249 Avatar answered Sep 20 '22 08:09

user2792249


I'm guessing you used Brew to install Node, so the guide here might be helpful http://madebyhoundstooth.com/blog/install-node-with-homebrew-on-os-x/.

You need to ensure that the npm/bin is in your path as it describes export PATH="/usr/local/share/npm/bin:$PATH". This is the location that npm will install the bin stubs for the installed packages.


The nano version will also work as described here http://architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/ but a restart of Terminal may be required to have the new path picked up.

like image 35
nschonni Avatar answered Sep 22 '22 08:09

nschonni