I’m having trouble with my Node.js app on Vercel. It uses a package to take website screenshots. Everything’s fine on my computer, but Vercel’s giving me a headache.
When I try to deploy, I get this error:
Error: Chromium not found. Can't take screenshots.
This might be because:
1. You forgot to install stuff before running the code
2. The place where Chromium is supposed to be is wrong
Your issue likely stems from Vercel’s serverless environment lacking Chromium. A workaround I’ve successfully implemented is using a headless browser API service instead of running Chromium directly. Services like Browserless or Puppeteer as a service can handle the heavy lifting externally. This approach eliminates the need for Chromium on Vercel’s servers and often improves performance. You’ll need to modify your code to make API calls to these services rather than using local browser instances. Additionally, ensure your Vercel configuration includes any necessary environment variables for API keys. This solution has proven reliable in my projects and might resolve your deployment troubles.
hey man, i had the same issue. vercel doesn’t have chromium built-in. what worked for me was using a serverless-compatible package like chrome-aws-lambda. you’ll need to tweak your code a bit, but it should solve the problem. also, make sure to add it to your dependencies. good luck!
I’ve encountered a similar issue with Vercel before. The problem is that Vercel’s serverless environment does not include Chromium by default, which is essential for many screenshot packages. In my case, switching to a lighter alternative like puppeteer-core helped because it doesn’t attempt to download Chromium automatically. I also adjusted my deployment by adding a custom build step in my package.json and ensured that any file operations were directed to the writable ‘/tmp’ directory. If you need more control over the environment, consider alternatives such as AWS Lambda with layers or even using a separate microservice for handling screenshots.