簡體   English   中英

無法在 bitbucket 管道中運行 npm 命令

[英]Unable to run npm command in bitbucket pipeline

我正在嘗試在 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_modules 時,NPM 不會再次運行安裝腳本。 Playwright 使用 NPM 安裝后腳本來安裝瀏覽器。 因此,您可以在那里禁用緩存或運行額外的npx playwright install ,這可能是該問題的更好解決方案。

此外,您可以使用npx playwright install-deps代替手動安裝系統依賴項,請參閱此處以供參考。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM