How to configure grunt in webstorm on windows

I use Webstorm (PHPStorm) on Windows 7. In a real project, we use grunt to concatenate javascript and css, as well as several other build processes.

I tried to configure the grunt command as an external start command in Webstorm. The settings I tried for this:

Name: grunt Parameters: none WorkingDirectory: $ProjectFileDir$ 

So, now when I try to run an external start command in Webstorm, I always get an error

 > grunt Cannot run program "grunt" (in directory "C:\Users\jawidmer\workspaces\projectname"): CreateProcess error=2, The system cannot find the file specified 

When I open the command line tool and navigate to the project folder, I can start without any problems.

I already searched on google and tried all kinds of combinations of settings, but it didn’t work.

Do you have any ideas what I need to change in order to start grumbling from external launch commands in Webstorm?

Thanks yang

+7
source share
3 answers

According to your description, I assume that just as I configured it in my WebStorm installation, it will work fine for you too:

Grunt webstorm configuration

Hope this helps.


UPDATE

It seems that if you add > %TEMP%\grunt & type %TEMP%\grunt & del %TEMP%\grunt to the parameters (as shown in the updated image), build errors will be shown.

If you need to configure a task (for example, grunt watch ), the "Parameters" field should be as follows:

 watch > %TEMP%\grunt & type %TEMP%\grunt & del %TEMP%\grunt 

Tip taken from here

+6
source

Perhaps this option will be useful for someone: Settings β†’ External Tools

enter image description here

With this tool, I can right-click the folder in the project and select grunt β†’ build in the context menu

0
source

I had problems with node contour and grunt in linux. I decided to add the following to Settings-> External Tools, I think that you can do the same in windows (PHPstorm 7 in the same dialog box as the previous answers):

Name: grunt Group: Node

Program: /opt/nodes/current/bin/node (my path to node files) Parameters: /my/directory/node_modules/grunt-cli/bin/grunt watch (my path to the grunt-cli binary and grunt job parameter) Working directory: /home/user/project/ (my path to Gruntfile.js)

0
source

All Articles