Error could not found chromium

Hi please can anyone solve this because i was getting this error in heroku so i decided to migrate into render.com but still the same error in render as well so kindly please suggest anyway of solving this.

Mar 1 05:32:05 PM ==> Starting service with ‘node index.js’
Mar 1 05:32:16 PM Example app listening on port 3000!
Mar 1 05:32:36 PM { Ans_value: ‘find lcm’ }
Mar 1 05:32:36 PM /opt/render/project/src/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:127
Mar 1 05:32:36 PM throw new Error(Could not find Chromium (rev. ${this.puppeteer.browserRevision}). This can occur if either\n +
Mar 1 05:32:36 PM ^
Mar 1 05:32:36 PM
Mar 1 05:32:36 PM Error: Could not find Chromium (rev. 1095492). This can occur if either
Mar 1 05:32:36 PM 1. you did not perform an installation before running the script (e.g. npm install) or
Mar 1 05:32:36 PM 2. your cache path is incorrectly configured (which is: /opt/render/.cache/puppeteer).
Mar 1 05:32:36 PM For (2), check out our guide on configuring puppeteer at Configuration | Puppeteer.
Mar 1 05:32:36 PM at ChromeLauncher.resolveExecutablePath (/opt/render/project/src/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:127:27)
Mar 1 05:32:36 PM at ChromeLauncher.executablePath (/opt/render/project/src/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:206:25)
Mar 1 05:32:36 PM at PuppeteerNode.executablePath (/opt/render/project/src/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PuppeteerNode.js:162:105)
Mar 1 05:32:36 PM at Object.scraptheweb (/opt/render/project/src/scrapers.js:24:23)
Mar 1 05:32:36 PM at /opt/render/project/src/index.js:25:37
Mar 1 05:32:36 PM at Layer.handle [as handle_request] (/opt/render/project/src/node_modules/express/lib/router/layer.js:95:5)
Mar 1 05:32:36 PM at next (/opt/render/project/src/node_modules/express/lib/router/route.js:144:13)
Mar 1 05:32:36 PM at Route.dispatch (/opt/render/project/src/node_modules/express/lib/router/route.js:114:3)
Mar 1 05:32:36 PM at Layer.handle [as handle_request] (/opt/render/project/src/node_modules/express/lib/router/layer.js:95:5)
Mar 1 05:32:36 PM at /opt/render/project/src/node_modules/express/lib/router/index.js:284:15
Mar 1 05:32:36 PM
Mar 1 05:32:36 PM Node.js v19.7.0
Mar 1 05:32:52 PM ==> Detected Node version 19.7.0
Mar 1 05:32:52 PM ==> Starting service with ‘node index.js’
Mar 1 05:33:01 PM Example app listening on port 3000!

Hi,

It can help to search the community before creating a new post, there’s been plenty of posts on Puppeteer.

Set an env var of PUPPETEER_CACHE_DIR to /opt/render/project/puppeteer

Then create a build script in your repo, e.g. render-build.sh. With something like:

#!/usr/bin/env bash
# exit on errorset -o errexit

npm install
# npm run build # uncomment if required

# Store/pull Puppeteer cache with build cache
if [[ ! -d $PUPPETEER_CACHE_DIR ]]; then 
  echo "...Copying Puppeteer Cache from Build Cache" 
  cp -R $XDG_CACHE_HOME/puppeteer/ $PUPPETEER_CACHE_DIR
else 
  echo "...Storing Puppeteer Cache in Build Cache" 
  cp -R $PUPPETEER_CACHE_DIR $XDG_CACHE_HOME
fi

Update your Build Command to call the build script, e.g. ./render-build.sh

Alan

1 Like

Thanks a lot for your reply this is issue is being solved. i am getting the reponse as well as the required output but in the render logs as seen in the attached pic. but once i look into the url i am getting the error can not get / this is the url for my webservice also my static service and the webservice are communicating together. but i am getting the can not get / error.


2

I solved this by adding a puppeteer.config.cjs file to my project which set the cache directory (as suggested at https://pptr.dev/) … I then had to manual deploy->clear build cache and deploy so that it would rebuild the dependencies.

2 Likes

General debugging would be beyond the scope of Render’s support, but maybe other community members will be able to chip in.

Essentially, your issues seem to be:

  • Incorrect host details for a MySQL database (going by the 3306 port in the screenshot)
  • And Cannot GET / is usually an Express response when a root path route hasn’t been defined.

Alan

Here’s how I solved this.

  1. Create a file in the root directory of your app called puppeteer.config.cjs and push to your repo.
  2. Deploy your app like this, click Manual Deploy and select Clear build cache and deploy.

As for the contents of your puppeteer.config.cjs file, try the code below:

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

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

Hope that helps.

2 Likes

For anyone having any troubles running that, make sure you’ve put a space between [[ and ! like:

if [[ ! -d $PUPPETEER_CACHE_DIR]]; then 
1 Like

If anyone is having issues with this method, try naming the file .puppeteerrc.cjs. This filename worked for me whereas puppeteer.config.cjs didn’t. The content of the file is the same though

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.