2

我正在尝试在 bitbucket 中运行以下管道

image: node:14-stretch

pipelines:
  default:
        - step:
            name: Install Depndencies
            caches:
              - node
            script:
                - apt update && apt install -y curl sudo git wget unzip xvfb libnss3 libgtk-3-0 libasound2 fonts-liberation
        - step:
            name: Install package.json
            script:
                - npm i
            caches:
              - node
        - step:
            name: Execute test
            caches:
              - node
            script:
                - npm run execute:test

管道在脚本 npm run execute:test 的最后一步失败,我认为它的缓存问题,但我不太确定如何管理,下面是错误日志

+ npm run execute:test
> playwright-fw@1.0.0 execute:test /opt/atlassian/pipelines/agent/build
> mocha
  Dashboard Test Suite
       browserType.launch: Failed to launch chromium because executable doesn't exist at /root/.cache/ms-playwright/chromium-888113/chrome-linux/chrome

尝试使用“npm install playwright”重新安装 playwright

4

1 回答 1

1

不幸的是,当您有可用的缓存 node_modules 时,NPM 不会再次运行安装脚本。Playwright 之后使用 NPM 安装后脚本来安装浏览器。因此,您可以在那里禁用缓存或运行附加缓存,npx playwright install这可能是该问题的更好解决方案。

此外,您可以使用npx playwright install-deps,而不是手动安装系统依赖项,请参阅此处以供参考。

于 2021-06-23T07:09:54.047 回答