Resolving grunt command not found error

Add the grunt binary to your NPM global path to get it working.
Resolving grunt command not found error

After installing grunt-cli on my machine at a training session during the Plone Conference 2017, I was getting the following error:

No command 'grunt' found, did you mean:
 Command 'grun' from package 'grun' (universe)
grunt: command not found

I tried the grunt command, but it did not find an installation path. When I tried running the sudo npm install -g grunt-cli, NPM reported that the package was already installed. It took a while before I realized that my NPM bin libraries are not accessible via the command line. By now, you should have a good idea of what to do, but just in case lets go through the fix together. The first thing you should do is to find out where is your NPM global path is by running the following command:

npm config get prefix

For instance, it outputted the following for me:

/home/ubuntu/.npm-global

You can test that grunt is working by adding bin/grunt your NPM global path and executing it. For instance:

/home/ubuntu/.npm-global/bin/grunt

At this point, you can export your NPM bin folder to your global environment by adding the following line to your ~/.bashrc file:

PATH=$PATH:/home/oshane/.npm-global/bin/

That should do the trick. If there's any other issue with your installation, please leave a comment in at the bottom of this page. For more information on NPM package installation, please read how to installing npm packages globally.

Go Back
Menu
×