【问题标题】:Puppeteer and Docker for Mac (Apple M1)适用于 Mac (Apple M1) 的 Puppeteer 和 Docker
【发布时间】:2023-01-08 19:58:22
【问题描述】:

在我的 M1 上使用以下堆栈跟踪通过 puppeteer 导航打开时,Chromium 崩溃了。我正在寻求社区的帮助,因为非基于 m1 的机器似乎对我们的 puppeteer 容器没有问题。

[0613/204124.018517:ERROR:stack_trace_posix.cc(707)] Failed to parse the contents of /proc/self/maps
[0613/204124.746267:ERROR:stack_trace_posix.cc(707)] Failed to parse the contents of /proc/self/maps
[0613/204124.751355:ERROR:stack_trace_posix.cc(707)] Failed to parse the contents of /proc/self/maps
[0613/204124.981155:FATAL:nacl_helper_linux.cc(440)] Check failed: nacl_sandbox->IsSingleThreaded().

qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[130:130:0613/204125.140482:FATAL:zygote_main_linux.cc(162)] Check failed: sandbox::ThreadHelpers::IsSingleThreaded().
#0 0x0040072b9339 <unknown>
#1 0x00400722ff23 <unknown>
#2 0x00400722d070 <unknown>
#3 0x00400722dc6e <unknown>
#4 0x004006dae926 <unknown>
#5 0x004006da973e <unknown>
#6 0x004006daa369 <unknown>
#7 0x004006dab0cb <unknown>
#8 0x004006da838e <unknown>
#9 0x004006da8d4e <unknown>
#10 0x0040036e1227 <unknown>
#11 0x00400faba0b3 <unknown>
#12 0x0040036e102a <unknown>
Crash keys:
  "switch-7" = "--enable-crashpad"
  "switch-6" = "--change-stack-guard-on-fork=enable"
  "switch-5" = "--user-data-dir=/tmp/puppeteer_dev_chrome_profile-5BphEe"
  "switch-4" = "--enable-crash-reporter=,"
  "switch-3" = "--crashpad-handler-pid=117"
  "switch-2" = "--enable-crashpad"
  "switch-1" = "--no-sandbox"
  "num-switches" = "8"

qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[112:138:0613/204125.830241:ERROR:file_path_watcher_inotify.cc(329)] inotify_init() failed: Function not implemented (38)
[0613/204125.946536:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Function not implemented (38)
Assertion failed: p_rcu_reader->depth != 0 (/qemu/include/qemu/rcu.h: rcu_read_unlock: 101)


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

Error scraping url: <my - url>: 
Error: Unable to launch chrome

我正在使用以下选项启动 puppeteer:

  const args = [
    '--no-first-run',
    '--no-sandbox',
    '--disable-setuid-sandbox',
    '--single-process',
    '--disable-dev-shm-usage',
    '--ignore-certificate-errors',
    '--ignore-urlfetcher-cert-requests',
    '--disable-blink-features=AutomationControlled'
  ];

我正在通过基于 ubuntu 的容器安装 Chromium:

# Install Chrome for Ubuntu
RUN apt-get update \
 && apt-get install -y chromium-browser

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium

【问题讨论】:

    标签: docker puppeteer apple-m1


    【解决方案1】:

    花了一整天试图修复它。最后使用 colima 运行 docker 解决了这个问题。问题是有些东西根本无法在 arm 上工作,并且没有必要与之抗争。 Colima 允许您通过 Rosetta 运行一切,因此一直模拟 x86。

    1. 首先使用brew install colima 安装 colima。
    2. 如果 docker 桌面正在运行,请将其关闭。
    3. 使用colima start --arch aarch64 --vm-type=vz 启动 colima(查看自述文件了解更多信息)
    4. 现在您可以通过 Rossetta 完全运行 docker。运行图像时,使用“--platform linux/amd64”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-23
      • 1970-01-01
      • 2020-04-04
      • 2021-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多