TeamCity:PhantomJS在60000毫秒内未捕获,导致死亡 [英] TeamCity: PhantomJS have not captured in 60000 ms, killing

查看:103
本文介绍了TeamCity:PhantomJS在60000毫秒内未捕获,导致死亡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的CI环境中运行测试时遇到问题.该配置在Mac OS 10.11.6(El Capitan)和Node v6.0.0/npm 3.8.6上运行良好,但是在运行Windows与Node v4.2.2/npm 2.14.7的Windows的TeamCity 9.1.6代理上,它却因失败而失败错误PhantomJS have not captured in 60000 ms.

I'm encountering an issue when running tests in my CI environment. The configuration works fine on MacOS 10.11.6 (El Capitan), with Node v6.0.0 / npm 3.8.6, but on a TeamCity 9.1.6 agent running Windows with Node v4.2.2 / npm 2.14.7, it fails miserably with an error of PhantomJS have not captured in 60000 ms.

这是TeamCity上的一个示例堆栈跟踪:

Here's an example stacktrace on 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的代码段:

Here's a snippet of 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的片段:

And here's a snippet of 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
});

推荐答案

问题已解决!在我们的CI环境中,我们没有通过运行npm install来获取节点模块-我们正在本地压缩node_modules目录并将其添加到源代码中.

Issue solved! In our CI environment, we aren't getting the node modules by running npm install - we are zipping the node_modules directory locally and adding it to our source code.

在Mac上将其压缩并在Windows上爆炸并尝试使用这些模块,尤其是phantomjs-prebuilt,是无法捕获的原因.

Zipping it on a Mac and exploding it on Windows and attempting to use those modules, especially phantomjs-prebuilt, is the reason why it wasn't capturing.

我改为从Windows压缩它,效果很好.

I zipped it from Windows instead and it worked perfectly.

这篇关于TeamCity:PhantomJS在60000毫秒内未捕获,导致死亡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆