如何在Windows上的webstorm中设置grunt

use*_*219 7 command-line webstorm gruntjs

我在Windows 7上使用Webstorm(PHPStorm).在实际项目中,我们使用grunt来连接javascript和css以及其他几个构建过程.

我试图在Webstorm中将grunt命令设置为外部运行命令.我试过的设置是:

Name: grunt  
Parameters: none  
WorkingDirectory: $ProjectFileDir$
Run Code Online (Sandbox Code Playgroud)

所以现在当我试图在Webstorm中启动我的外部运行命令时,我总是得到错误

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

当我打开命令行工具并导航到项目文件夹时,我可以毫无问题地开始咕噜声.

我已经在谷歌搜索并尝试了各种不同的设置组合,但没有他们工作..

你有什么想法,我必须改变什么才能从Webstorm中的外部运行命令开始咕噜咕噜?

谢谢Jan

gus*_*nke 6

根据您的描述,我假设我在WebStorm安装中配置它的方式也应该适合您:

Grunt WebStorm配置

我希望它有所帮助.


UPDATE

似乎如果添加> %TEMP%\grunt & type %TEMP%\grunt & del %TEMP%\grunt参数(如更新的图像中所示),将显示构建错误.

如果需要配置任务(例如grunt watch),则"参数"字段必须如下:

watch > %TEMP%\grunt & type %TEMP%\grunt & del %TEMP%\grunt
Run Code Online (Sandbox Code Playgroud)

提示取自这里