puppeteer: [Bug]: Error: Could not find Chromium (rev. 1069273)

Bug expectation

I expected to successfully run puppeteer, as it always did in prior versions.

I instead got 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/sysadm/.cache/puppeteer). For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration. at ChromeLauncher.resolveExecutablePath (/var/www/html/oas-restapi-fork1/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:119:27) at ChromeLauncher.executablePath (/var/www/html/oas-restapi-fork1/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:205:25) at ChromeLauncher.launch (/var/www/html/oas-restapi-fork1/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:93:37)

Bug behavior

  • Flaky
  • PDF

Minimal, reproducible example


"use strict";

const puppeteer = require ('puppeteer');

async function main () {

    try {

        // instantiate puppeteer
        console.log (`Launching puppeteer`);
        const browser = await puppeteer.launch ();

        // create new page:
        console.log (`Creating page`);
        const page = await browser.newPage ();

    } catch (err) {

        console.log (err);

    }

}

main ();

Error string

Error: Could not find Chromium (rev. 1069273)

Puppeteer configuration


Puppeteer version

19.6.0

Node version

v16.19.0

Package manager

npm

Package manager version

9.3.0

Operating system

Linux

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 17
  • Comments: 45 (1 by maintainers)

Commits related to this issue

Most upvoted comments

As a workaround it should be possible to run node node_modules/puppeteer/install.js to download the binary. It’s the same file that npm is supposed to invoke.

FWIW I have puppeteer running in a Google Cloud Function using Puppeteer 21.0.2 and Node v20 following these directions. The three main bits are:

  1. adding gcp-build to scripts in package.json
  2. adding the .puppeteerrc.cjs file
  3. make sure the function has at least 1gb of ram

npm clean-install

this installed the “cache\puppeteer\chrome\win64-1095492” and solved my problem.

I was having this error for revision 1069273, then bumped to puppeteer 19.6.2, deployed to Google Cloud Function, and the error went away. Then a little later I did another deployment for an unrelated reason, and the error came back again on a new revision 1083080.

So it doesn’t seem that 19.6.2 fixes the issue.

Rolling back to puppeteer version 18 resolves the issue.

I solved it like this to be able to deploy in the cloud

In my Dockerfile

RUN apk add --no-cache udev ttf-freefont chromium git ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true ENV CHROMIUM_PATH /usr/bin/chromium-browser

To start the browser

puppeteer.launch({ executablePath: process.env.CHROMIUM_PATH, args: [‘–no-sandbox’], // This was important. Can’t remember why });

Thanks for sharing but sometimes you don’t even have a dockerfile, for example in AWS lambda functions and in firebase functions. They just install your package.json.

I don’t understand why this library suddenly doesn’t work out of the box and needs extra work after being installed.

Solved the issue after using these commands:

  1. npm cache clean --force

  2. npm install puppeteer

I had this issue with ^19.8.0 on cloud functions. The issue was the build layer used when deploying cloud functions contains the chromium binaries already. A simple node_modules/puppeteer/install.js said it already found in the build log. cloud functions use a different base container image for runtime. The trick was the set the cache directory inside the application source directory. Using puppeteer.config.js file in the root and the sample from the docs:

const { join } = require("path");

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

GCP Functions copies the source code directory to the runtime container allowing it to find the cache. Cheers.

I got this error complaining couldn’t found Chromium 1095492, but in fact the installed version is 1083080.

Puppeteer 19.6.1

Error: Could not find Chromium (rev. 1095492). 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: C:\Users\MyUserName\.cache\puppeteer).
    For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
PS C:\Users\MyUserName\.cache\puppeteer\chrome> ls


    Directory: C:\Users\MyUserName\.cache\puppeteer\chrome


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         3/11/2023  11:12 AM                win64-1083080

I actually noticed the main issue does not say anything about cloud functions, but since resolving the issue on a machine you have terminal access to is very easy, I think the actual problem here is to fix the issue for cloud function runners like AWS lambda or Firebase functions.

npm clean-install

I copy this from a guy here and works for me using puppeteer

npm -v 9.7.1

node -v v20.2.0

@RoelLeal man, how did you do it? I spent 3 days. This fucker no matter what, can’t find the headless chrome. It deploys normally but when I test the function I always get the same error.

I use Google Cloud Functions. There is nothing on Google Cloud for Puppeteer v.20.x everyone says that works fine, but always older versions.

Got this error after upgrade, tried cleaning cache and this got resolved for me.

foo@bar:~$ npm cache clean --force

Hello, is there any solution for this problem?

In a Windows environment, a global installation of Puppeteer solved the problem:

npm i puppeteer -g

So far nothing in this issue worked for me. I “found” that my chromium installation was like so: .cache/puppeteer/chrome/linux-113.0.5672.63/chrome-linux64/

And my error said the following: Could not find Chromium (rev. 1069273). This can occur if either ...

So I renamed my chromium folder and it worked:

mv .cache/puppeteer/chrome/linux-113.0.5672.63/ .cache/puppeteer/chrome/linux-1069273/
mv .cache/puppeteer/chrome/linux-1069273/chrome-linux64/ .cache/puppeteer/chrome/linux-1069273/chrome-linux

I am not using a project. I am using NVM and installing puppeteer globally, so I really have no clue where to put the said .puppeteerrc.cjs. Maybe in /home/erp/.nvm/versions/node/v16.20.0/lib/node_modules/npm/? That said I tried using the environment variables and they didn’t work either:

PUPPETEER_CACHE_DIR="/home/erp/.cache" ... PUPPETEER_CACHE_DIR="/home/erp/.cache/puppeteer" ...

This article from justus (https://twitter.com/intent/user?screen_name=justusbluemer) explains the Google Cloud Functions issue and a great fix here: https://hume.dev/articles/puppeteer-google-cloud-functions-v2/

I’m still experiencing this issue despite trying all the workarounds. My issue specifically is that we can’t get this to work in an AWS lambda.

I solved it like this to be able to deploy in the cloud

In my Dockerfile

RUN apk add --no-cache udev ttf-freefont chromium git ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true ENV CHROMIUM_PATH /usr/bin/chromium-browser

To start the browser

puppeteer.launch({ executablePath: process.env.CHROMIUM_PATH, args: [‘–no-sandbox’], // This was important. Can’t remember why });

This one worked for me, thanks!

Definitely looks like it. Could it be an issue with NVM? It is a fresh install after all. The revision 1069273 is expected by puppeteer but npm install -g puppeteer installs the 113.0.5672.63 revision.

Very random but persistent issue. It seems not reproducible if you run a single script with no concurrency. Try with concurrency and long running scripts like in a real world scenario. When it breaks (and it breaks during script execution), it is not recoverable until a new npm ci. And then, it can breaks after 26 minutes or after 3 minutes, but when it breaks it will not recover even if you re-run the same script.