【问题标题】:Unable to run npm command in bitbucket pipeline无法在 bitbucket 管道中运行 npm 命令
【发布时间】:2021-09-06 04:41:49
【问题描述】:

我正在尝试在 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

【问题讨论】:

    标签: node.js yaml bitbucket-pipelines playwright bitbucket-cloud


    【解决方案1】:

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

    也可以使用npx playwright install-deps代替手动安装系统依赖,参考here

    【讨论】:

    • 此命令 npx playwright install-deps 抛出无法安装此 linux 发行版的依赖项!
    • 那么 Playwright 在您的平台上不受官方支持。有关支持的平台,请参见此处:playwright.dev/docs/intro#system-requirements
    猜你喜欢
    • 2017-01-11
    • 1970-01-01
    • 2022-06-22
    • 2022-08-17
    • 2017-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-29
    相关资源
    最近更新 更多