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

CMSCSS picture CMSCSS · Jan 9, 2014 · Viewed 59.9k times · Source

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

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

Answer

thomaux picture thomaux · Jan 9, 2014

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.