Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puppeteer Error: Chromium revision is not downloaded

I used npm i puppeteer as stated in the Documentation and I'm getting the following error:

(node:2066) UnhandledPromiseRejectionWarning: Error: Chromium revision is not downloaded. Run "npm install" or "yarn install" at Launcher.launch

when im trying this example (also from the docs):

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(); })(); 

Also in the documentation:

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.

Any help would be appreciated.

like image 256
Moses Schwartz Avatar asked Jan 01 '19 16:01

Moses Schwartz


People also ask

What is Chromium revision?

node-chromium-revision allows you to easily add Chromium binaries to your project and use it for automation, testing, web scraping or just for fun.

Does puppeteer require Chrome installed?

By default, Puppeteer downloads and uses a specific version of Chromium so its API is guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium, pass in the executable's path when creating a Browser instance: const browser = await puppeteer.


2 Answers

I only managed to fix the issue by manually installing Chromium after much searching and trying most of the suggestions:

node node_modules/puppeteer/install.js 
like image 63
Afshin Ghazi Avatar answered Sep 19 '22 21:09

Afshin Ghazi


After many attempts I finally found the answer here:

sudo npm install puppeteer --unsafe-perm=true --allow-root 

As @vsync pointed out, this only works for linux

like image 40
Moses Schwartz Avatar answered Sep 17 '22 21:09

Moses Schwartz