Puppeteer-extra: Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"

Created on 8 Jan 2020  路  5Comments  路  Source: berstend/puppeteer-extra

I receive the following error when using puppeteer-extra with Electron on MacOS 10.15.2:

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

I am using the following function to open new browsers (note: it works fine with the regular puppeteer package):

async function openWindow(url)
{
    // Open a new window in headful mode
    const browser = await puppeteer.launch(
    {
        headless: false,
        defaultViewport: null,
    });

    // Create a reference to the first page
    const pages = await browser.pages();
    const page = pages[0];

    // Go to the url
    await page.goto(url);
}

I have tried running npm install again, but the error persisted.

Most helpful comment

I've yet to find what I consider a suitable solution :(. Some people say you can just specify the path to your chromium app with the executablePath option, but that isn't a very cross platform solution.

Edit: Just to be a bit more explicit, (on MacOS), you'd have to do something like:

const browser = await puppeteer.launch(
{
    headless: false,
    executablePath: "./node_modules/puppeteer/.local-chromium/mac-722234/chrome-mac/Chromium.app/Contents/MacOS/Chromium",
    defaultViewport: null,
});

All 5 comments

Does anyone resolve this? please help

I've yet to find what I consider a suitable solution :(. Some people say you can just specify the path to your chromium app with the executablePath option, but that isn't a very cross platform solution.

Edit: Just to be a bit more explicit, (on MacOS), you'd have to do something like:

const browser = await puppeteer.launch(
{
    headless: false,
    executablePath: "./node_modules/puppeteer/.local-chromium/mac-722234/chrome-mac/Chromium.app/Contents/MacOS/Chromium",
    defaultViewport: null,
});

I just check log again and found that I missed puppeteer-extra module due to npm install not work, it require install manually, so I just install it and work well

You could do what @JustinELRoberts suggested. Or you could install puppeteer directly like npm install puppeteer --save.

I think puppeteer-extra defaults to using puppeteer-core if available.

My project is structured using yarn workspaces. A different workspace in the project used puppeteer-core and that installation was being picked up by puppeteer-extra.

So for me the solution was adding the following to the package.json of the project using puppeteer-core:

 "workspaces": {
    "nohoist": [
      "puppeteer",
      "puppeteer/**",
      "puppeteer-core",
      "puppeteer-core/**"
    ]
  },

This made it so puppeteer-core was only installed in the workspace directory. And couldn't be picked up by puppeteer-extra.

Was this page helpful?
0 / 5 - 0 ratings