TFS(vNext)+ Karma + Chrome:Chrome在60000毫秒内没有捕获,导致

时间:2016-08-30 16:45:41

标签: google-chrome tfs build karma-runner tfsbuild

enter image description here enter image description here

我正在尝试通过内部版本的TFS 2015(vNext)构建我们团队的UI。 我在vNext中使用Grunt构建步骤来调用gruntjs文件,该文件将构建所有grunt任务。

目前,构建失败,因为任务无法启动chrome并且超时“Chrome未在60000毫秒内被捕获,正在查杀”。 我看到它可以启动某些grunt任务的chrome但是却失败了。 当我运行grunt命令直接从构建服务器上的cmdline或powershell控制台调用gruntjs文件时,它可以工作完全没问题但是它从vNext版本中失败了。

我将镀铬版本从“52.0.2743.116米”回滚到“51.0.2704.103米”并试用但仍未成功。

我浏览了讨论相同问题的链接。但我不确定这是否是一个铬问题,因为它适用于一些繁重的任务。

自上周以来,我一直坚持这一点,即将放弃,任何帮助都会非常棒。

由于

错误

[32m31 08 2016 11:27:53.800:INFO [karma]: [39mKarma v0.13.22 server started at http://localhost:8888/
[32m31 08 2016 11:27:53.815:INFO [launcher]: [39mStarting browser Chrome
[33m31 08 2016 11:28:49.663:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:28:49.757:INFO [launcher]: [39mTrying to start Chrome again (1/2).
[33m31 08 2016 11:28:53.834:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:28:53.912:INFO [launcher]: [39mTrying to start Chrome again (1/2).
[33m31 08 2016 11:29:49.779:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:29:49.842:INFO [launcher]: [39mTrying to start Chrome again (2/2).
[33m31 08 2016 11:29:53.931:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:29:53.993:INFO [launcher]: [39mTrying to start Chrome again (2/2).
[33m31 08 2016 11:30:49.852:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[31m31 08 2016 11:30:49.930:ERROR [launcher]: [39mChrome failed 2 times (timeout). Giving up.
[33mWarning: Task "karma:ci" failed. Use --force to continue.[39m
[31mAborted due to warnings.[39m
    [33mWarning:  Use --force to continue.[39m

    [31mAborted due to warnings.[39m
Grunt failed with error: C:\Users\user1\AppData\Roaming\npm\grunt.cmd failed with return code: 6

2 个答案:

答案 0 :(得分:1)

我可以通过使用“nosandbox”来修复Chrome来修复它并修复它。

在karma project.conf.js中使用以下配置:

browsers: ['ChromeNoSandbox'],
    customLaunchers: {
        ChromeNoSandbox: {
            base: 'Chrome',
            flags: ['--no-sandbox']
        }
    }

答案 1 :(得分:0)

这对我有用:

1)安装人偶

npm install puppeteer --save-dev

2)将此代码添加到模块导出功能顶部的karma conf:

const puppeteer = require('puppeteer');
process.env.CHROME_BIN = puppeteer.executablePath();

3)禁用Chrome沙箱:

browsers: ['ChromeNoSandbox'],
customLaunchers: {
    ChromeNoSandbox: {
        base: 'Chrome',
        flags: ['--no-sandbox']
    }
}