Webstorm does not recoginize Grunt

gruntjs, macos, webstorm

Solution

Do you use NVM to manage Node versions? The problem might be caused by the way NVM uses to patch enviornment variables. Usually it places its initialization logic in ~/.bashrc

If WebStorm is launched from Terminal, it inherits Terminal environment (including modified PATH environment variable, added NVM_DIR env var, etc). In that case, there are no problems with loading Grunt tasks, as WebStorm sees correct PATH value.

If WebStorm is lauched from Desktop (not from Terminal), WebStorm sees incorrect PATH value and fails to load Grunt tasks.

If you're using bash as shell, workaround could be the the following: edit your WebStorm launcher and set command to "/bin/bash -l -c "/path/to/webstorm.sh". This command will perform bash login (i.e. reading your .bashrc/.bash_profile files) and after that will run webstorm.sh.

Hope that will help.

Problem

So I have messed up with removing and installing node and npm to install packages without sudo and now I can't use Grunt panel in Webstorm The message is: ``` grunt --no-color --gruntfile /Users/max/repos/cb/Gruntfile.js --tasks /Applications/WebStorm.app/plugins/JavaScriptLanguage/grunt_js/tasks _intellij_grunt_tasks_fetcher Cannot run program "grunt" (in directory "/Users/max/repos/cb"): error=2, No such file or directory Looks like the grunt command isn't in your system path. In order to view/run tasks, you need to install Grunt's command line interface globally: npm install -g grunt-cli For more information, please see http://gruntjs.com/getting-started ``` But what is strange than I can run grunt from terminal, even in Webstorm. Screenshot: Notice that i have `grunt-cli` installed.

Original source

Related problems