【问题标题】:Cypress dependency issues in Docker containerDocker 容器中的 Cypress 依赖问题
【发布时间】:2021-11-27 18:18:37
【问题描述】:

我正在尝试将 cypress 集成到 bitbucket 管道中。我正在关注官方文档:

- step:
    script:
      # install dependencies
      - npm ci
      # run Cypress tests
      - npm run e2e (env variables here)

我在本地启动容器如下:

docker run -v `pwd`:/mycode -it imagename /bin/sh

cd /mycode
and I run the steps in the script:
/mycode# npm ci; npm run e2e (env variables here)

但我收到以下错误:

/root/.cache/Cypress/8.2.0/Cypress/Cypress: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory

当我得到 libgtk2.0-0 缺少依赖项时,我按照文档运行了apt-get install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2,,它抛出了下一个。 我还添加了 :nvm install "lts/*" --reinstall-packages-from="$(nvm current)" 作为将节点更新到最新版本并符合 cypress 要求的步骤, 但是有没有关于如何将 cypress 集成到现有项目的管道中并解决这些库问题的一般做法? 修复只是为了安装库还是有更好的集成实践和我缺少的东西?

【问题讨论】:

    标签: continuous-integration cypress bitbucket-pipelines


    【解决方案1】:

    您实际上只能在要运行测试的步骤中使用官方 cypress 映像。 You can choose the version 最适合你。

          - step:
              name: run tests
              image: cypress/browsers:node12.18.3-chrome87-ff82
              script:
                # install dependencies
                - npm ci
                # run Cypress tests
                - npm run e2e (env variables here)
    
    

    【讨论】:

      猜你喜欢
      • 2021-07-14
      • 2020-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多