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
This question is related to
gruntjs
My fix for this on Mountain Lion was: -
npm install -g grunt-cli
Saw it on http://gruntjs.com/getting-started
Also on OS X (El Capitan), been having this same issue all morning.
I was running the command "npm install -g grunt-cli" command from within a directory where my project was.
I tried again from my home directory (i.e. 'cd ~') and it installed as before, except now I can run the grunt command and it is recognised.
the key point is finding the right path where your grunt was installed.
I installed grunt through npm, but my grunt path was /Users/${whoyouare}/.npm-global/lib/node_modules/grunt/bin/grunt
. So after I added /Users/${whoyouare}/.npm-global/lib/node_modules/grunt/bin
to ~/.bash_profile
,and source ~/.bash_profile
, It worked.
So the steps are as followings:
1. find the path where your grunt was installed(when you installed grunt, it told you. if you don't remember, you can install it one more time)
2. vi ~/.bash_profile
3. export PATH=$PATH:/your/path/where/grunt/was/installed
4. source ~/.bash_profile
You can refer http://www.hongkiat.com/blog/grunt-command-not-found/
For windows
npm install -g grunt-cli
npm install load-grunt-tasks
Then run
grunt
I have been hunting around trying to solve this one for a while and none of the suggested updates to bash seemed to be working. What I discovered was that some point my npm root was modified such that it was pointing to a Users/USER_NAME/.node/node_modules
while the actual installation of npm was living at /usr/local/lib/node_modules
. You can check this by running npm root
and npm root -g
(for the global installation). To correct the path you can call npm config set prefix /usr/local
.
Source: Stackoverflow.com