2016-06-08 83 views
0

有沒有人有CruiseControl上運行gulp的任何經驗? 我們有一些麻煩,通過xml配置文件自動化過程。任務可以通過CommandPrompt手動啓動本地和虛擬機,但是從CruiseControl的啓動時出現錯誤:在CruiseControl.NET上運行gulp任務

ThoughtWorks.CruiseControl.Core.Tasks.BuilderException: Unable to execute: gulp TaskName 

System.IO.IOException: Unable to execute file [D:\CC.NET\VSS\%CorrectPathName%\gulp]. The file may not exist or may not be executable. 

任何幫助深表感謝。

UPDATE 想什麼西蒙·萊恩曾建議後,開始得到另一個錯誤:

<buildresults> 
    <message level="Error">module.js:327</message> 
    <message level="Error"> throw err;</message> 
    <message level="Error"> ^</message> 
    <message level="Error">Error: Cannot find module 'D:\CC.NET\VSS\Path\to\the\project\gulp'</message> 
    <message level="Error"> at Function.Module._resolveFilename (module.js:325:15)</message> 
    <message level="Error"> at Function.Module._load (module.js:276:25) </message> 
    <message level="Error"> at Function.Module.runMain (module.js:441:10) </message> 
    <message level="Error"> at startup (node.js:139:18)</message> 
    <message level="Error"> at node.js:968:3</message> 
    </buildresults> 
    </build> 
    </cruisecontrol> 

的路徑設置爲:%APPDATA%\ NPM,一飲而盡通過

安裝
npm install gulp -g 

npm install gulp --save-dev 

在我看來,配置啓動節點,在一個錯誤的地方搜索吞嚥。

回答

3

Gulp通過gulp-cli從命令行正常執行,不需要執行nodegulp參數。

要解決您的問題,您需要告訴巡航控制哪個可執行文件(node.exe)使用哪個工具運行,它是參數。

你的情況應該是:

  • 文件名:Path\to\node.exe
  • 參數:gulp <any-other-switches>

替代解決方案,得到CMD爲你執行節點:

  • 文件名:c:\windows\system32\cmd.exe
  • 參數:/c gulp <any-other-switches>

cmd就可以讀取路徑和執行備忘gulp-cli如果你手動調用它會控制。

+0

感謝您的回答。現在得到另一個錯誤: '錯誤:無法找到模塊'D:\ path \ to \ gulp' at Function.Module._resolveFilename(module.js :module.js:276:25) at Function.Module.runMain(module.js:325:15) at Function.Module.load :441:10) at startup(node.js:139:18)

+0

這是非常明顯的巡航控制沒有看到吞食文件的路徑。我仍然無法弄清楚它是如何改變的。 –

+0

已經在全球或每個用戶安裝了gulp嗎? –

0

遲到的答案,我知道但是,即使在嘗試上述接受的答案中的方法後,我仍然有同樣的問題。

就我而言,我使用「au build」來構建aurelia應用程序,該應用程序需要查找並運行節點。無論我嘗試了多少次,我都無法讓CCNet看到路徑,所以我在該任務中添加了一個「環境」塊,並將我的系統路徑目錄複製到其中。

一旦我這樣做了,一切都很開心。

僅供參考,這是我的CCNet.config文件中的exec任務現在的樣子。

<cruisecontrol xmlns:cb="urn:ccnet.config.builder"> 

<project name="blahproject"> 


    <sourcecontrol type="git"> 
    ... 
    </sourcecontrol> 

    <triggers> 
    ... 
    </triggers> 

    <tasks> 

     <exec> 
      <executable>C:\windows\system32\cmd.exe</executable> 
      <baseDirectory>C:\myproject\working\folder</baseDirectory> 
      <buildArgs>/c au build</buildArgs> 
      <buildTimeoutSeconds>60</buildTimeoutSeconds> 
      <successExitCodes>0</successExitCodes> 
      <environment> 
      <variable> 
       <name>path</name> 
       <value>C:\Users\Administrator\AppData\Roaming\npm;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\MSBuild\14.0\Bin;C:\Program Files\nodejs\</value> 
      </variable> 
     </environment> 
     </exec> 

    <msbuild> 
     ... 
    </msbuild> 

    </tasks> 

</project> 

</cruisecontrol> 

正如你所看到的,環境設置,使我的所有的工具,可以發現,在使用基本目錄標籤,有效地設置工作目錄,你的項目文件的路徑。