puppeteer: [Bug]: Error retrieving document: Error: Could not find Chrome (ver. 114.0.5735.90)
Bug expectation
I was trying to open a website for my scrapping that i hosted on cloud run, but the problem that i was encountering that when it run always gives me [Bug]: Error retrieving document: Error: Could not find Chrome (ver. 114.0.5735.90)
Bug behavior
- Flaky
Minimal, reproducible example
import cheerio from "cheerio";
import puppeteer from 'puppeteer';
import randomUseragent from 'random-useragent';
export const scrapeData = async (productName) => {
const product = productName.replace(/ /g, "+");
console.log(1);
const url = `https://www.tokopedia.com/search?st=product&q=${product}`;
const randomAgent = randomUseragent.getRandom();
const browser = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
],
});
console.log(2);
const context = await browser.createIncognitoBrowserContext();
const page = await context.newPage();
await page.setJavaScriptEnabled(true);
await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36");
const domLoadedPromise = new Promise((resolve) => {
page.once('load', resolve);
});
await page.goto(url, { waitUntil: 'networkidle0' });
// await page.waitForSelector('[data-testid="master-product-card"]');
await domLoadedPromise;
const body = await page.evaluate(() => {
return document.querySelector('body').innerHTML;
});
const $ = cheerio.load(body);
const listItems = $('[data-testid="master-product-card"]');
console.log(3);
var result
listItems.each(function (idx, el) {
var nama = $('[data-testid="spnSRPProdName"]', el).text();
var harga = $('[data-testid="spnSRPProdPrice"]', el).text();
var image = $('[data-testid="imgSRPProdMain"]', el).attr("src");
var link = $('a[href]', el).attr("href");
if (harga != null && harga != "") {
result = {
"Treatment for": productName,
"nama": nama,
"harga": harga,
"link": link,
"image": image
};
return false
}
});
console.log("Url: ", url);
console.log("For This Product: ", productName);
await browser.close();
return result;
};
Error string
Error retrieving document: Error: Could not find Chrome (ver. 114.0.5735.90)
Puppeteer configuration
# Use the official Node.js 14 image as the base
FROM node:18
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
# Install project dependencies
RUN npm install
# Install necessary dependencies for Puppeteer
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Copy the rest of the project files to the working directory
COPY . .
# Start the Express application
CMD [ "npm", "run", "dev" ]
Puppeteer version
20.6.0
Node version
18
Package manager
npm
Package manager version
18
Operating system
Linux
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 71
Commits related to this issue
- Downgrade puppeteer to 19.11.0 in an attempt to fix https://github.com/puppeteer/puppeteer/issues/10388 — committed to zemn-me/monorepo by Zemnmez 8 months ago
Run node_modules/puppeteer/install.js to download the binary
Same error for me with Firebase Hosting after deploying since yesterday :
Could not find Chrome (ver. 114.0.5735.133)
I tried everything, but nothing works :npm clean-install
npm cache clean --force
"gcp-build": "node node_modules/puppeteer/install.js"
(doens’t work because node_modules doesn’t seem to be accessible from the root hosting directory…)puppeteer.config.js
as detailed in the puppeteer docs : https://pptr.dev/guides/configuration/#changing-the-default-cache-directoryUnfortunately, i tried to downgrade puppeteer to the previews working version for me on Firebase Hosting wich was 10.4.0 and it still doesn’t work.
This is very frustrating and urgent for me as part of the website i need to deploy is currently out of service !
I noticed that when I try to install puppeteer in local, the
.cache/puppeteer
folder does not install every time. On ten tries, the.cache/puppeteer
directory has only been installed once.So I don’t think that it is a problem with Firebase Hosting but rather with Puppeteer or the Chrome install server.
This issue needs to be reopenned.
Same issue here:
Could not find Chrome (ver. 114.0.5735.133)
I’m having the same issue.
error Could not find Chrome (ver. 114.0.5735.133).
Hey everyone,
I managed to resolve this issue by following the instructions outlined in this documentation.
Here’s a summary of the steps you need to take:
Create a file named
.puppeteerrc.cjs
in your root folder.Add the following content to the file:
Update your docker file with the following step after npm install:
RUN npx puppeteer browsers install chrome
Deploy your changes.
For local testing purposes, simply comment out the content in
.puppeteerrc.cjs
.Following these steps, I successfully tested the flow on my Google Cloud Run instance. This approach might also work for Lambdas or Cloud Functions.
Let me know should you need any help
linux/ubuntu, node v16.20.2 here - after
npm i puppeteer
I rannode node_modules/puppeteer/install.mjs
All good 😃
@besnikh
this worked for me
I already add
.pupeteerrc.cjs
in project. Locally this thing works for me, but it doesn’t work in digital ocean server.Running into the same issue. This is my first time installing Puppeteer. When I check
chromium-browser --product-version
it returns 115.0.5790.102, but trying to run the script calling Puppeteer returns an error that includesCould not find Chrome (ver. 115.0.5790.98)
. I tried adding a .puppeteerrc.cjs like @vvivan89 suggested. I uninstalled and reinstalled Puppeteer with npm, but I’m still getting the same error.The problem I encountered: Using version 20, I downloaded a zip file in the $HOME/. cache/puppeteer/chrome folder, but the file was not successfully extracted. I attempted to manually extract it but also failed.
Guess: There is an issue downloading the compressed package, link Chrome for Testing in github README I am unable to access and feel puzzled.
Solution: I have specified to install version 19 instead of the default version 20.
yarn add puppeteer@19
I’m seeing this too, was working fine but just stopped working on a fresh install. Does this always pull the latest chrome? Seen issues with this and Cypress before
Same here, can confirm that install.mjs script doesn’t help anymore. Running AWS Lambda functions based on Docker container with this setup:
I’m still got the same problem
Node: v18.17.1
Already install the puppeteer by
npm install puppeteer
and runcd node_modules && node puppeteer/install.mjs
It returnsChrome (119.0.6045.105) downloaded to /home/master/.cache/puppeteer/chrome/linux-119.0.6045.105
I check the
~/.cache/puppeteer/chrome
, and there is a file directory name linux-119.0.6045.105 with its sub directories chrome-linux64Still not work after all these steps 😦( Please help
In my case everything works perfectly when i first deploy the firebase function, but after the next deploy it throws error "Could not find Chrome… ", and maybe it would happen even with a new instance of the function (not sure about that) My guess is that gcp-build is not always running so i tried running node node_modules/puppeteer/install.js in my function using fork(). After installing it “manually” it works again.
I would like to call this function after every deploy and not letting user wait for it. Is there a way to do it ?
Confirming this fix also.
This works very well => in my case it was “node_modules/puppeteer/install.mjs” Thank you so much
Yes that worked. Delete the current version from cache and run
node node_modules\puppeteer\install.mjs
(Extension was mjs, not js in my case)Discovery: The cache in
...\.cache\puppeteer\chrome
can be erroneous or not update.install.js
might claim the version you need is installed, but the datetime stamp didn’t change. I got suspicious, so I deleted the old version, then rannode node_modules\puppeteer\install.js
to pull it down again. My problem was fixed afterwards.Facing the same issue with version 114.0.5735.133 Had to change downloaded version using “browserRevision” in the .puppeteerrc.cjs:
browserRevision: '117.0.5897.0'
This version resolved the issue.
The latest downloadable version could be found here.
Same issue here: Could not find Chrome (ver. 114.0.5735.133). I have added .puppeteerrc.cjs, but when deploy to Firebase function (node 18), the error still appears. I have tried to set the cache dir tobe under different folder like .cache, node_modules, but none of it works. I think it might related to how firebase-tools deploy the bundle.
@sk8killer some people have commented that there might (have been/) be some issues with the server chrome binary is being downloaded from.
still experiencing this as well:
Could not find Chrome (ver. 114.0.5735.90)
the bug happened when i was trying to connect browser const browser = await puppeteer.launch({ headless: true, args: [ ‘–no-sandbox’, ‘–disable-setuid-sandbox’, ], });
I configured docker file to install all dependencies that was needed to run at cloud.