相关疑难解决方法(0)

为什么 Puppeteer 需要 --no-sandbox 在 Cloud Functions 中启动 Chrome

当我使用 Node 8 在 Cloud Functions 上运行 Puppeteer 时,出现此错误。

Error: Failed to launch chrome!
[1205/063825.588245:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Run Code Online (Sandbox Code Playgroud)

启动 Puppeteer

browser = await puppeteer.launch({
    args: ['--no-sandbox'],
    headless: true
})
Run Code Online (Sandbox Code Playgroud)

解决了这个问题。我在互联网上搜索过,但找不到任何必要的理由?

为什么 Headless Chrome 首先以 root 身份运行?

node.js firebase google-cloud-functions google-chrome-headless puppeteer

8
推荐指数
1
解决办法
3720
查看次数