Issue with Puppeteer: Chromium revision not found

I executed the command npm install puppeteer as instructed in the official guide, but I’m encountering the following error:

(node:2066) UnhandledPromiseRejectionWarning: Error: Chromium revision is not found. Please execute “npm install” or “yarn install”

This mistake arises when I attempt to run the provided example (also from the official guide):

const puppeteer = require('puppeteer');
(async () => {
  const browserInstance = await puppeteer.launch();
  const newPage = await browserInstance.newPage();
  await newPage.goto('https://example.com');
  await newPage.screenshot({path: 'output.png'});
  await browserInstance.close();
})();

Additionally, the documentation indicates that:

Note: Installing Puppeteer will automatically download a suitable version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to be compatible with the API.

Could anyone offer guidance on resolving this issue?

Hey Alice! Try running npm install again to ensure all dependencies are correctly set. Alternatively, install a specific Chromium revision manually:

npm install puppeteer --ignore-scripts
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer

Afterwards, run:

PUPPETEER_EXECUTABLE_PATH=$(which chromium) node your_script.js

This approach skips Chromium download and uses your local version. Hope that helps!

Hi Alice45, it appears you're dealing with a common issue regarding the Chromium download process during Puppeteer's installation. Here's a streamlined approach to solving this efficiently:

Step 1: Update Node.js and npm

Ensure you're using the latest versions. This can often resolve compatibility issues.

Step 2: Clear npm Cache

Running clear commands can eliminate corrupted data, which might be causing installation hiccups:

npm cache clean --force

Step 3: Reinstall Puppeteer

Retry the installation to ensure all necessary components are downloaded correctly:

npm install puppeteer

Step 4: Manual Fix (if necessary)

If the error persists, bypass automatic Chromium download by configuring Puppeteer to use an already installed version of Chromium on your system:

npm install puppeteer --ignore-scripts
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer

Then, update your script to point to your local Chromium instance:

const puppeteer = require('puppeteer');
(async () => {
  const browserInstance = await puppeteer.launch({
    executablePath: '/path/to/your/chromium'
  });
  const newPage = await browserInstance.newPage();
  await newPage.goto('https://example.com');
  await newPage.screenshot({path: 'output.png'});
  await browserInstance.close();
})();

Substitute /path/to/your/chromium with the actual path to your installed Chromium.

By following these steps, you ensure each potential issue is addressed methodically, making your setup efficient and reliable. Good luck!

To resolve the "Chromium revision not found" issue with Puppeteer, the solution often lies in ensuring that Puppeteer successfully downloads the Chromium binary. Here's a step-by-step guide to troubleshoot and solve the problem:

Step 1: Verify Node.js and npm Versions

Ensure that your Node.js and npm versions are up to date as older versions might cause installation issues.

Step 2: Clean npm Cache and Reinstall Puppeteer

Sometimes cache issues can lead to incomplete installations. Clearing the npm cache and reinstalling Puppeteer might help:

npm cache clean --force
npm install puppeteer

Step 3: Manual Chromium Installation

If the problem persists, you can manually install a compatible Chromium revision and point Puppeteer to use it. Follow these steps:

npm install puppeteer --ignore-scripts
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer

Then, specify the path to your local Chromium executable in your Puppeteer script:

const puppeteer = require('puppeteer');
(async () => {
  const browserInstance = await puppeteer.launch({
    executablePath: '/path/to/chromium'
  });
  const newPage = await browserInstance.newPage();
  await newPage.goto('https://example.com');
  await newPage.screenshot({ path: 'output.png' });
  await browserInstance.close();
})();

Replace /path/to/chromium with the actual path to your Chromium executable.

Step 4: Check Network Policies

If you’re working behind a proxy or firewall, ensure that these don’t block the Chromium binary from downloading. Sometimes setting the HTTP_PROXY and HTTPS_PROXY environment variables can assist the download.

export HTTP_PROXY=http://your-proxy-url:port
export HTTPS_PROXY=http://your-proxy-url:port

If these steps do not resolve the issue, reviewing Puppeteer’s official troubleshooting guide or reaching out to their support community might be the next best steps. Hope this helps in getting your Puppeteer script running smoothly!