gpt4 book ai didi

puppeteer - puppeteer 师 : How to specify Chromium path on Linux

转载 作者:行者123 更新时间:2023-12-05 00:42:10 32 4
gpt4 key购买 nike

我在 Linux 环境中,我想了解如何指定它应该用于 Chromium 的路径。目前,这是我遇到的错误:

Chromium revision is not downloaded. Run "npm install" or "yarn
install" Error: Chromium revision is not downloaded. Run "npm
install" or "yarn install" at Launcher.launch

我确实通过使用变量 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 故意禁用了下载,但是,我还没有找到如何提供我的 chromium 二进制文件的路径。

最佳答案

在调用 puppeteer.launch 时使用选项 executablePath 指定 Chromium 二进制文件的路径.

引用文档:

executablePath: Path to a Chromium or Chrome executable to run instead of the bundled Chromium. If executablePath is a relative path, then it is resolved relative to current working directory. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.

代码示例

const browser = await puppeteer.launch({
executablePath: '/path/to/binary',
/* ... */
});

关于puppeteer - puppeteer 师 : How to specify Chromium path on Linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57305779/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com