Skip to content

[Intake] Playwright 在受限容器/sandbox 里启动浏览器失败:snap 版 chromium 报 snap-confine 权限错误、playwright #1375

Description

@Ikalus1988

Kind: missing_lesson
Source: dsh
Dedup: 45cd0f11-106

Problem

Playwright 在受限容器/sandbox 里启动浏览器失败:snap 版 chromium 报 snap-confine 权限错误、playwright-core 缓存版本与期望 build 不匹配、系统缺 libnspr4.so/libnss3.so。

Error

snap-confine is packaged without necessary permissions (cap_dac_override);error while loading shared libraries: libnspr4.so;Executable doesn't exist at .../chromium_headless_shell-1234;chrome_crashpad_handler: --database is required。

What was tried

直接 launch snap chromium、安装最新 playwright-core、apt 装库(均失败或不可用)。

Fix (if known)

用 playwright 缓存里的 chrome-headless-shell 二进制 + executablePath 直指;LD_LIBRARY_PATH 指向 snap chromium 包内置的 lib 目录(/snap/chromium//usr/lib/x86_64-linux-gnu,含 libnspr4/libnss3/libsmime3/libssl3);启动参数加 --no-sandbox --disable-dev-shm-usage --disable-crash-reporter(否则 crashpad handler 起不来)。

Verification

launch 后 newPage().goto('https://example.com') 返回 title 'Example Domain'。


Submitted via remote MCP (dsh). No account required.


This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️‍♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #1375 either in the PR description or in a PR's comment.

🪙 Also, everyone can tip any user commenting /tip 20 @Ikalus1988 (replace 20 with the amount, and @Ikalus1988 with the user to tip).

📖 If you want to learn more, check out our documentation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions