Puppeteer Error: Chromium revision is not downloaded

node.jsNpmChromiumPuppeteer

node.js Problem Overview


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.

node.js Solutions


Solution 1 - node.js

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

Solution 2 - node.js

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

Solution 3 - node.js

By default, the puppeteer module will run its install script (node install.js). However, in my case, I enabled ignore-scripts=true in my ~/.npmrc file, so it was never executed.

In that case, you have to run the command yourself:

node node_modules/puppeteer/install.js

To check: node_modules/puppeteer/.local-chromium/linux-<your_chrome_version>/ should exist now.

Solution 4 - node.js

for linux:

1- you must have installed chromium browser using this command :
> $sudo apt install -y chromium-browser

2- you have to get the excutable path of chromium using this command : > $which chromium-browser

3-put the executable path as an argument to the launch function :

   const puppeteer = require('puppeteer-core');
   (async () => {
   const browser = await puppeteer.launch({
   executablePath: '/usr/bin/chromium-browser',
   headless: false
    });
    const page = await browser.newPage();
    await page.goto('https://google.com');
    await page.screenshot({path: 'example.png'});

    await browser.close();
    })();
 

Solution 5 - node.js

Confirming solutions presented here almost work. Here's my setup. Ubuntu 16.

Install chromium browser from command line then:

    const browser = await puppeteer.launch({
        executablePath: "/usr/bin/chromium-browser",
        args: ['--no-sandbox']
    });

Solution 6 - node.js

In my case, it worked after deleting node_modules folder and package-lock.json file and running npm install again.

Solution 7 - node.js

I solved it like this:

const browser = await puppeteer.launch({ executablePath: "./node_modules/puppeteer/.local-chromium/win64-656675/chrome-win/chrome.exe"});

note the win64-656675 in the path, if you're on a different operating system you will need to point to the appropriate folder.

puppeteer version: 1.16.0

Solution 8 - node.js

After couple of hours googling and reading many comments and discussions, trying several approach finally I resolved the problem with this solution.

OS: Windows 10
node: 14.16.1
puppeteer: 7.0.1

I saw in the node_modules/puppeteer/ folder and found that there isn't any .local-chromium folder so I created this path manually

node_modules/puppeteer/.local-chromium/win64-<your_chrome_version>/chrome-win

Then I downloaded the chromium browser from this link (your_chrome_version) and so copied it to the path so that you need to see the chrome.exe in this url

node_modules/puppeteer/.local-chromium/win64-<your_chrome_version>/chrome-win/chrome.exe

That's it. it worked for me.

Solution 9 - node.js

This is because you don't have Chrome installed on your system.

For installing Chrome

sudo apt install -y chromium-browser

then after that add an executable path.

const browser = await puppeteer.launch({
  executablePath: '/usr/bin/chromium-browser',
  headless: false
});

Solution 10 - node.js

If someone still facing this problem again. Then goto node_modules folder then into puppeteer and in lib where you find launch.js open the same file and search for executablepath then change its null value to your chrome or chromium desired path.

For me the path as follows : >/home/Nightwing/node_modules/puppeteer/Launcher.js

Solution 11 - node.js

On Windows works installing as global

npm i puppeteer --g

Solution 12 - node.js

Here is how I solved it

  const browser = await puppeteer.launch({
      headless: true,
      ignoreDefaultArgs: ['--disable-extensions'], // this made it work for now
  });

By simply having ignoreDefaultArgs: ['--disable-extensions'] done the trick

Source: Troubleshoot

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMoses SchwartzView Question on Stackoverflow
Solution 1 - node.jsAfshin GhaziView Answer on Stackoverflow
Solution 2 - node.jsMoses SchwartzView Answer on Stackoverflow
Solution 3 - node.jsPhilipp ClaßenView Answer on Stackoverflow
Solution 4 - node.jsAmr HusseinView Answer on Stackoverflow
Solution 5 - node.jsf1vladView Answer on Stackoverflow
Solution 6 - node.jsVikash GuptaView Answer on Stackoverflow
Solution 7 - node.jsRoy.BView Answer on Stackoverflow
Solution 8 - node.jsHamid ShojaView Answer on Stackoverflow
Solution 9 - node.jsabhishek TomerView Answer on Stackoverflow
Solution 10 - node.jsRahul9989View Answer on Stackoverflow
Solution 11 - node.jsEdward Mamani FloresView Answer on Stackoverflow
Solution 12 - node.jsMohamedView Answer on Stackoverflow