繁体   English   中英

如何在Windows上的webstorm中设置grunt

[英]how to setup grunt in webstorm on windows

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

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

Name: grunt  
Parameters: none  
WorkingDirectory: $ProjectFileDir$

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

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

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

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

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

谢谢Jan

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

Grunt WebStorm配置

我希望它有所帮助。


UPDATE

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

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

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

提示取自这里

也许这个变体对某些人有用:设置 - >外部工具

在此输入图像描述

使用此工具,我可以右键单击项目中的文件夹,然后在上下文菜单中选择grunt - > build

因为我在linux中遇到了node和grunt的路径问题。 我决定在Settings-> External Tools中添加以下内容,我猜在windows中可以用同样的方式完成(PHPstorm 7,在与之前答案相同的对话框中):

名称:grunt组:节点

程序: /opt/nodes/current/bin/node (我的节点文件路径)参数: /my/directory/node_modules/grunt-cli/bin/grunt watch (我的grunt-cli二进制路径和任务的参数) of grunt)工作目录: /home/user/project/ (我的Gruntfile.js路径)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM