berstend / puppeteer-extra

💯 Teach puppeteer new tricks through plugins.
https://extra.community
MIT License
6.38k stars 738 forks source link

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

Closed JustinELRoberts closed 4 years ago

JustinELRoberts commented 4 years ago

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.

VanHop94 commented 4 years ago

Does anyone resolve this? please help

JustinELRoberts commented 4 years ago

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,
});
VanHop94 commented 4 years ago

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

itsdarrylnorris commented 4 years ago

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

bramvanhoutte commented 3 years ago

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.