【问题标题】:puppeteer runs locally but not in Git Pipelinepuppeteer 在本地运行,但不在 Git Pipeline 中
【发布时间】:2022-01-20 05:13:26
【问题描述】:

我写了一个管道,它应该运行脚本“npm run test”。 本地 npm run test 工作得很好。 这是我的管道的一部分:

test:
  tags:
    - docker
    - migros
  stage: test
  script:
    - npm install node@16.13.0
    - npm run test

但是当我将代码推送到 gitlab 时,管道失败并显示以下错误消息:

Setup Puppeteer
Error: Failed to launch the browser process!
/builds/devops-open-source/net.migros.news-hub.reactfrontend/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
    at onClose (/builds/devops-open-source/net.migros.news-hub.reactfrontend/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
    at Interface.<anonymous> (/builds/devops-open-source/net.migros.news-hub.reactfrontend/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
    at Interface.emit (node:events:402:35)
    at Interface.close (node:readline:586:8)
    at Socket.onend (node:readline:277:10)
    at Socket.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Error: Command failed with exit code 1: npm run testing
    at makeError (/builds/devops-open-source/net.migros.news-hub.reactfrontend/node_modules/start-server-and-test/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/builds/devops-open-source/net.migros.news-hub.reactfrontend/node_modules/start-server-and-test/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  shortMessage: 'Command failed with exit code 1: npm run testing',
  command: 'npm run testing',
  escapedCommand: '"npm run testing"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! net.migros.news-hub.frontend@0.1.0 test: `start-server-and-test develop http://localhost:8000 testing`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the net.migros.news-hub.frontend@0.1.0 test 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!     /root/.npm/_logs/2021-12-17T08_20_03_043Z-debug.log

我该如何解决这个问题?

【问题讨论】:

  • error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory 您可能需要在管道中安装这些库。也许一种简单的方法是使用你的包管理器安装 chrome/chromium,它应该包括 puppeteer 运行 chromium 所需的所有要求。

标签: node.js npm puppeteer gitlab-ci pipeline


【解决方案1】:

设置 Puppeteer 错误:无法启动浏览器进程! /builds/devops-open-source/net.migros.news-hub.reactfrontend/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome:加载共享库时出错:libatk-1.0.so。 0:无法打开共享对象文件:没有这样的文件或目录

您的跑步者/图像没有运行 chromium/chrome 所需的库。您需要在您的运行程序/图像或作业中安装系统依赖项才能使其正常工作。例如apt install -y chromium-browserapt install -y google-chrome(添加了 repos)用于基于 ubuntu/debian 的系统。

【讨论】:

    猜你喜欢
    • 2021-01-29
    • 2018-03-23
    • 2019-10-04
    • 2021-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-13
    • 1970-01-01
    相关资源
    最近更新 更多