Puppeteer. Error: Could not find Chromium (rev. 1069273)

If you got such an error:

Error: Could not find Chromium (rev. 1069273). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /home/ruslan/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
    at ChromeLauncher.resolveExecutablePath (/home/ruslan/Projects/puppeteer-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:120:27)
    at ChromeLauncher.executablePath (/home/ruslan/Projects/puppeteer-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:166:25)
    at ChromeLauncher.launch (/home/ruslan/Projects/puppeteer-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:70:37)

Solution:

  1. Add file .puppeteerrc.cjs to your project root
const {join} = require('path');

/**
 * @type {import("puppeteer").Configuration}
 */
module.exports = {
  // Changes the cache location for Puppeteer.
  cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};

For more details read here https://pptr.dev/guides/configuration/#changing-the-default-cache-directory

2. Reinstall Puppeteer.

npm uninstall puppeteer
npm i puppeteer

If it doesn’t help, try the solution from the discussion here https://github.com/spatie/browsershot/discussions/681#discussioncomment-4081949

Categories: js

You might also like



Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.