簡體   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