2
votes

I was using node 0.10.35 and grunt command was working fine. Now after upgrading to 0.12.3 grunt command has stopped working.

OS: Mac OSX 10.10.1 node: 0.12.3 npm: 2.9.1 grunt: 0.4.5

I thought there may be problem in node installation, so I clean installed it 3-4 times

I tried installing with -

  1. node-v0.12.3.pkg
  2. Node Version Manager (nvm)

Many of solutions to such problems have suggested to use npm install -g grunt-cli

and then use npm install to install local node-modules.

I followed that procedure but I getting the same error.

2
Can you check whether you have the binary (or link) in /usr/local/bin? Try the following: ls -als /usr/local/bin/grunt. This should point to the binary installed by grunt-cli.nwinkler
Since I installed nodejs with nvm, I don't have node executable inside /usr/local/bin folder. It is placed in /Users/<Username>/.nvm/versions/node/v0.12.3/bin folder. Grunt Execuble was inside /Users/<Username>/.node/bin folder.Neha
Thanks nwinkler. I got an idea from your comment. I added /Users/<Username>/.node/bin in PATH variable. After that grunt command worked.Neha
Cool, glad to hear that it worked. Please add this as an answer so other people can see this as well.nwinkler

2 Answers

1
votes

Find where alias to grunt executable is located and check whether path to the file exist in PATH environment variable. If it doesn't exist, add path inside PATH.

Normally, grunt executable is added inside, /usr/local/bin folder. But for my installation, it was placed inside /Users/<Username>/.node/bin folder. So I needed to add /Users/<Username>/.node/bin path to PATH variable.

To know how to edit PATH environment variable, see link.

-1
votes

Assuming you have grunt installed which by the looks of it you have, you can manually enable the command by opening ~/.bashrc and appending the following at the end of the file

eval "$(grunt --completion=bash)"