2016-11-02 45 views
4

我在CI環境中運行測試時遇到問題。該配置在MacOS 10.11.6(El Capitan)上運行良好,Node v6.0.0/npm 3.8.6,但在運行Windows且配置了Node v4.2.2/npm 2.14.7的TeamCity 9.1.6代理上,錯誤PhantomJS have not captured in 60000 msTeamCity:PhantomJS在60000毫秒內沒有捕獲,造成

這裏有TeamCity的一個例子堆棧跟蹤:

[08:58:40][exec] 02 11 2016 08:58:41.095:DEBUG [config]: autoWatch set to false, because of singleRun 
[08:58:40][exec] 02 11 2016 08:58:41.102:DEBUG [plugin]: Loading plugin karma-jasmine. 
[08:58:40][exec] 02 11 2016 08:58:41.107:DEBUG [plugin]: Loading plugin karma-chrome-launcher. 
[08:58:40][exec] 02 11 2016 08:58:41.121:DEBUG [plugin]: Loading plugin karma-firefox-launcher. 
[08:58:40][exec] 02 11 2016 08:58:41.128:DEBUG [plugin]: Loading plugin karma-phantomjs-launcher. 
[08:58:40][exec] 02 11 2016 08:58:41.263:DEBUG [web-server]: Instantiating middleware 
[08:58:41][exec] 02 11 2016 08:58:41.595:INFO [karma]: Karma v1.3.0 server started at http://localhost:9877/ 
[08:58:41][exec] 02 11 2016 08:58:41.596:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency 
[08:58:41][exec] 02 11 2016 08:58:41.616:INFO [launcher]: Starting browser PhantomJS 
[08:58:41][exec] 02 11 2016 08:58:41.618:DEBUG [temp-dir]: Creating temp dir at E:\TCA\3\temp\buildTmp\karma-47802965 
[08:58:41][exec] 02 11 2016 08:58:41.631:DEBUG [launcher]: E:\TCA\3\work\f900f2fe23d6c9b0\Preview\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs E:\TCA\3\temp\buildTmp\karma-47802965/capture.js 
[08:59:41][exec] 02 11 2016 08:59:41.621:WARN [launcher]: PhantomJS have not captured in 60000 ms, killing. 
[08:59:43][exec] 02 11 2016 08:59:43.624:WARN [launcher]: PhantomJS was not killed in 2000 ms, sending SIGKILL. 
[08:59:45][exec] 02 11 2016 08:59:45.627:WARN [launcher]: PhantomJS was not killed by SIGKILL in 2000 ms, continuing. 
[08:59:45][exec] 02 11 2016 08:59:45.628:DEBUG [launcher]: Process PhantomJS exited with code -1 
[08:59:45][exec] 02 11 2016 08:59:45.629:DEBUG [temp-dir]: Cleaning temp dir E:\TCA\3\temp\buildTmp\karma-47802965 
[08:59:45][exec] 02 11 2016 08:59:45.637:DEBUG [launcher]: PhantomJS failed (timeout). Not restarting. 
[08:59:45][exec] 02 11 2016 08:59:45.638:DEBUG [karma]: Run complete, exiting. 
[08:59:45][exec] 02 11 2016 08:59:45.639:DEBUG [launcher]: Disconnecting all browsers 
[08:59:45][exec] Warning: Task "karma:unit" failed. Use --force to continue. 
[08:59:45][exec] 
[08:59:45][exec] Aborted due to warnings. 
[08:59:45][exec] npm ERR! Test failed. See above for more details. 

這裏的package.json的一個片段:

"devDependencies": { 
    "bower": "latest", 
    "grunt": "^1.0.1", 
    "grunt-cli": "^1.2.0", 
    "grunt-contrib-jshint": "^1.0.0", 
    "grunt-contrib-watch": "^1.0.0", 
    "grunt-istanbul-coverage": "^0.1.4", 
    "grunt-karma": "^2.0.0", 
    "karma": "^1.3.0", 
    "karma-chrome-launcher": "^2.0.0", 
    "karma-cli": "^1.0.1", 
    "karma-firefox-launcher": "^1.0.0", 
    "karma-jasmine": "^1.0.2", 
    "karma-phantomjs-launcher": "^1.0.2", 
    "jasmine-core": "^2.5.2", 
    "matchdep": "^1.0.1" 
}, 
"scripts": { 
    "postinstall": "node ./node_modules/bower/bin/bower install", 
    "test": "node ./node_modules/.bin/grunt default" 
} 

而這裏的karma.conf.js的一個片段:

module.exports = function (config) { 
'use strict'; 

config.set({ 
    frameworks: ['jasmine'], 
    plugins: [ 
     'karma-jasmine', 
     'karma-chrome-launcher', 
     'karma-firefox-launcher', 
     'karma-phantomjs-launcher' 
    ], 
    files: [ 
     <...> 
    ], 
    exclude: [], 
    preprocessors: { 
    }, 
    reporters: ['progress'] 
    port: 9877, 
    runnerPort: 9101, 
    colors: true, 
    logLevel: config.LOG_DEBUG, 
    autoWatch: true, 
    browsers: ['PhantomJS'], 
    captureTimeout: 60000, 
    singleRun: true 
}); 
+0

[大隻佬PhantomJS Github的相關問題(https://github.com/karma-runner/karma-phantomjs-launcher/issues/84)。 – Thunderforge

回答

2

問題解決了!在我們的CI環境中,我們沒有通過運行npm install來獲取節點模塊 - 我們正在將node_modules目錄本地壓縮並將其添加到我們的源代碼中。

荏苒它在Mac上和爆炸在Windows上,並嘗試使用這些模塊,尤其是phantomjs-prebuilt,這就是爲什麼它沒有捕捉的原因。

我從Windows壓縮它,它完美的工作。

1

我已經有PhantomJS have not captured in 60000 ms, killing本地和af問題可從classpath中PhantomJS之間VS phatomjs-prebuilt下載到項目的node_modules

  1. 衝突:TER一些嘗試事實證明,它可能已經造成。我剛剛刪除了全球可用的一個。
  2. 缺少PHANTOMJS_CDNURL環境(系統)變量,指向一個Maven倉庫,檢查where to get PhantomJS
+0

感謝您的回覆,@ jediz。但是,除了node_modules中的預建構件外,沒有其他PhantomJS實例。此外,似乎沒有下載PhantomJS的問題,因爲我們不幸將node_modules作爲構建期間解壓縮的壓縮目錄。 –

+0

謝謝!你的建議1.爲我做了詭計 – Tarken

相關問題