【发布时间】:2013-10-07 16:16:22
【问题描述】:
我正在尝试在 Jenkins CI 中的 Ubuntu 12.04 机器上运行 karma 作为一项繁重的任务。我遇到的问题是 karma 不会打开 Chrome 并给出以下错误:
Started by GitHub push by spencerapplegate
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/jobs/rescour-roomba master/workspace
Checkout:workspace / /var/lib/jenkins/jobs/rescour-roomba master/workspace - hudson.remoting.LocalChannel@7b41ce14
Using strategy: Default
Last Built Revision: Revision ee61ceea1b8728e90b01db04a1813284a524caed (origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
Commencing build of Revision d3ed5ffd7c7b7a707bd9310c5bce09242e1faced (origin/master)
Checking out Revision d3ed5ffd7c7b7a707bd9310c5bce09242e1faced (origin/master)
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content
CHROME_BIN=/opt/google/chrome/
[EnvInject] - Variables injected successfully.
[workspace] $ /bin/sh -xe /tmp/hudson5570746814297674358.sh
+ sudo npm install
+ sudo grunt buildProd
Loading "express.js" tasks...
[31mERROR[39m[31m>> [39mError: Cannot find module 'temp'
[4mRunning "clean:build" (clean) task[24m
Cleaning ".tmp"...[32mOK[39m
Cleaning "build/app"...[32mOK[39m
Cleaning "build/app-config"...[32mOK[39m
Cleaning "build/components"...[32mOK[39m
Cleaning "build/img"...[32mOK[39m
Cleaning "build/index.html"...[32mOK[39m
Cleaning "build/scripts"...[32mOK[39m
Cleaning "build/src"...[32mOK[39m
Cleaning "build/styles"...[32mOK[39m
[4mRunning "copy:local" (copy) task[24m
Created [36m370[39m directories, copied [36m2260[39m files
[4mRunning "compass:prod" (compass) task[24m
[31m[0m[32mdirectory[0m .tmp/styles/
[31m[0m[32m create[0m .tmp/styles/main.css (1.732s)
Compilation took 1.784s
[4mRunning "template:prod" (template) task[24m
[4mRunning "clean:template" (clean) task[24m
Cleaning ".tmp/index.html.template"...[32mOK[39m
[4mRunning "karma:unit" (karma) task[24m
[36m[2013-10-07 10:07:51.709] [DEBUG] config - [39mautoWatch set to false, because of singleRun
[32mINFO [karma]: [39mKarma server started at http://localhost:8079/
[32mINFO [launcher]: [39mStarting browser Chrome
[31mERROR [launcher]: [39mCannot start Chrome
[32mINFO [launcher]: [39mTrying to start Chrome again.
[31mERROR [launcher]: [39mCannot start Chrome
[32mINFO [launcher]: [39mTrying to start Chrome again.
[31mERROR [launcher]: [39mCannot start Chrome
[33mWarning: Task "karma:unit" failed. Use --force to continue.[39m
[31mAborted due to warnings.[39m
Build step 'Execute shell' marked build as failure
SSH: Current build result is [FAILURE], not going to run.
Finished: FAILURE
我已经设置了 CHROME_BIN=/opt/google/chrome 并且似乎找到可执行文件没有问题。
我采取的其他方法(均不成功)是: -> 创建 shell 脚本以使用标志 --user-data-dir 以 root 身份打开 chrome -> 将所有 chrome 文件复制到 jenkins 子目录 /home/jenkins/opt/google/chrome -> 将 /opt/google/chrome 中所有 chrome 文件的所有权更改为 jenkins
另一个奇怪的是,当我以 jenkins 用户身份登录机器时,chrome 可以正常运行测试。
如果我需要提供更多信息,请告诉我。谢谢
【问题讨论】:
-
我遇到了完全相同的问题(包括以 jenkins 用户身份登录并成功运行,包括为 bin 设置路径),但在我的情况下它是 firefox。你在这方面有没有成功。如果是这样,我建议发布我很乐意 +1 的答案。
标签: google-chrome jenkins ubuntu-12.04 gruntjs karma-runner