Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt installed but not working - "Command not found" on Mavericks

I'm trying to use grunt with sass and have been following these guides:

  • http://gruntjs.com/getting-started

  • http://benfrain.com/lightning-fast-sass-compiling-with-libsass-node-sass-and-grunt-sass/

  • http://www.hongkiat.com/blog/grunt-command-not-found/

I've:

  • Intsalled node.js

  • Installed the command-line version of grunt: sudo npm install -g grunt -cli

  • Added the path from the grunt installer to my bash profile: export PATH=/usr/local/lib/node_modules/grunt/bin:$PATH

  • Made the profile an executable: source ~/.bash_profile

  • Setup package.json and Gruntfile.js files in my project root

  • Installed grunt into the project: cd /path/to/project/root/ and sudo npm install

But when I try to run grunt I see: command not found

It's the same if I run: grunt --version

I wasn't sure if the bash path needs /bin on the end as per the blog posted above but have tried it both ways: /usr/local/lib/node_modules/grunt/ and /usr/local/lib/node_modules/grunt/bin/

I've also run the grunt installer several times but didn't see any errors so am positive it's installed - can anyone see what I'm doing wrong? I'm running OSX mavericks incase this is the issue.

Any pointers in the right direction would be much appreciated.

Cheers

like image 597
CMSCSS Avatar asked Jan 09 '14 09:01

CMSCSS


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.

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 .


1 Answers

You have a typo in your command. The package is named grunt-cli without the space.

Update the command to:

sudo npm install -g grunt-cli 

And all should work as expected.

like image 88
thomaux Avatar answered Oct 25 '22 03:10

thomaux