docker - Jenkins 错误安装 Xvfb 并再次运行 Cypress

标签 docker jenkins jenkins-pipeline

创建一个管道来做jenkins cypress测试,但我总是运行它,出错,并尝试各种解决方案,包括Jenkins Xvfb,但我仍然没有成功。

错误

+ npm run exec:e2e

> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96e6e4f9fcf3f5e2f8f7fbf3d6a6b8a7b8a6" rel="noreferrer noopener nofollow">[email protected]</a> exec:e2e /var/lib/jenkins/workspace/project/myproject
> npx cypress run

It looks like this is your first time using Cypress: 3.4.0

[?25l[01:56:21]  Verifying Cypress can run /var/lib/jenkins/.cache/Cypress/3.4.0/Cypress [started]
[01:56:21]  Verifying Cypress can run /var/lib/jenkins/.cache/Cypress/3.4.0/Cypress [failed]
[?25hYour system is missing the dependency: Xvfb

Install Xvfb and run Cypress again.

Read our documentation on dependencies for more information:

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.

----------

Error: spawn Xvfb ENOENT

----------

Platform: linux (Ubuntu Linux - 19.04)
Cypress Version: 3.4.0
[?25hnpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2c2c0ddd8d7d1c6dcd3dfd7f2829c839c82" rel="noreferrer noopener nofollow">[email protected]</a> exec:e2e: `npx cypress run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c6b6b4a9aca3a5b2a8a7aba386f6e8f7e8f6" rel="noreferrer noopener nofollow">[email protected]</a> exec:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2019-07-24T01_56_21_795Z-debug.log

最佳答案

我用其他解决方案解决了这个问题。

首先,我创建了一个管道

stage('E2E Tests') {
    sh 'docker run -v $PWD:/e2e -w /e2e cypress/included:3.4.0'
}

关于docker - Jenkins 错误安装 Xvfb 并再次运行 Cypress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57174266/

相关文章:

git - Jenkins 管道 : is it possible to avoid multiple checkout?

Jenkins 声明性管道为并行构建创建自定义工作区

docker - 无法运行官方Docker教程容器:npm ERR!缺少脚本:开始

docker - 容器初始化导致\“rootfs_linux.go:58:挂载到rootfs引起的不是目录

ruby-on-rails - 带有 docker-compose 的 Rails 应用程序无法读取 .env 文件

jenkins - 如何设置 jenkins 身份验证 token ?

在 jenkinsfile 中找不到 mysqldump

jenkins - 如何在另一个jenkins管道B中调用jenkins管道A

Jenkins 声明式管道锁名称与变量

docker - 重击 : No such file or directory when running a dockerfile