人偶错误:未下载Chromium版本 [英] Puppeteer Error: Chromium revision is not downloaded
本文介绍了人偶错误:未下载Chromium版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如 npm i puppeteer >文档
,出现以下错误:
I used npm i puppeteer
as stated in the Documentation
and I'm getting the following error:
(节点:2066)UnhandledPromiseRejectionWarning:错误:铬修订版为未下载。在尝试此示例时(也在文档中)运行 npm install或 yarn install
在Launcher.launch
:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
await browser.close();
})();
也在文档中:
注意:安装Puppeteer时,它会下载保证可以使用该API的最新版本的Chromium(约170MB Mac,约282MB Linux,约280MB Win)。
Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API.
任何帮助将不胜感激。
推荐答案
经过多次尝试,我终于在此处找到了答案:
After many attempts I finally found the answer here:
sudo npm install puppeteer --unsafe-perm=true --allow-root
正如@vsync指出的那样,这仅适用于linux
As @vsync pointed out, this only works for linux
这篇关于人偶错误:未下载Chromium版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文