grunt: command not found when running from terminal

后端 未结 6 1706
礼貌的吻别
礼貌的吻别 2020-12-23 08:58

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 bel

相关标签:
6条回答
  • 2020-12-23 09:18

    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.

    0 讨论(0)
  • 2020-12-23 09:20

    For windows

    npm install -g grunt-cli

    npm install load-grunt-tasks

    Then run

    grunt

    0 讨论(0)
  • 2020-12-23 09:24

    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.

    0 讨论(0)
  • 2020-12-23 09:34

    My fix for this on Mountain Lion was: -

    npm install -g grunt-cli 
    

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

    0 讨论(0)
  • 2020-12-23 09:34

    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.

    0 讨论(0)
  • 2020-12-23 09:34

    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/

    0 讨论(0)
提交回复
热议问题