Hey everyone,
I wanted to share an issue I ran into while trying to deploy Puppeteer on Render.com. After deploying my app, I encountered an error message that indicated Puppeteer was failing to find Chromium on Render.com because Render.com does not include $HOME/.cache
in the project’s deployment
"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"
I researched the Render.com docs for how to copy over specific files from the build environment to the production environment, but I didn’t find a solution to my problem. Additionally, the Deploy Puppeteer with Node page in the Render.com documentation does not mention any specific configuration for Puppeteer.
After further investigation, I needed to create a puppeteer.config.cjs
file in the project root directory that specifies the location where Puppeteer should store cached data through the cacheDirectory
option. This joins the current directory (__dirname)
with a .cache/puppeteer
subdirectory to create the necessary directory path.
const { join } = require('path');
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {cacheDirectory: join(__dirname, '.cache', 'puppeteer')};
I hope this information is helpful for anyone else who may be encountering this issue. Let me know if you’ve found any other solutions.
Thanks