switz
switz

Reputation: 25188

Use puppeteer-core and installing chromium manually

By including the puppeteer package, you automatically download and install Chromium which is ~200MB download.

But puppeteer is just one component of our repo, and some users may want to clone and run commands in our repo without downloading the entire Chromium bundle. Basically, it's an opt-in subset of the repo.

Now this is all well and good, they provide the useful puppeteer-core package which doesn't bundle Chromium. Awesome.

But how do I manually install Chromium so that puppeteer-core finds it? I just get the following error no matter what I try (e.g. globally installing puppeteer).

Chromium revision is not downloaded.

I'm using yarn if that affects anything. A nice simple brew and apt command would be super useful here, but I'd even write a quick bash/node script to handle the installation if need be.

Upvotes: 13

Views: 29386

Answers (1)

Thomas Dondorf
Thomas Dondorf

Reputation: 25230

You can manually download Chromium (e.g. via this page or this page) and then set the executablePath when launching it:

const browser = await puppeteer.launch({
    executablePath: 'path/to/your/chrome.exe'
});

Check out this issue on the puppeteer github repository for more information on what to download from where.

Upvotes: 17

Related Questions