grunt: command not found when running from terminal

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

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.


My fix for this on Mountain Lion was: -

npm install -g grunt-cli 

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


For windows

npm install -g grunt-cli

npm install load-grunt-tasks

Then run

grunt

链接地址: http://www.djcxy.com/p/27636.html

上一篇: Grunt.js:什么

下一篇: grunt:从终端运行时找不到命令