Hey folks, I’m stuck with a weird problem on my Ubuntu 24.04 setup. I’m trying to get Puppeteer Cluster going, but it keeps bombing out with this error:
Error creating puppeteer cluster Unable to launch browser, error message: kill EACCES
I’ve done all the usual stuff:
- Installed Chromium and double-checked the path
- Added a bunch of dependencies (too many to list here)
- Set the Chromium path in my Puppeteer options
- Made the Chromium binary executable
- Cleared out package-lock.json and reinstalled everything
Here’s a snippet of my Puppeteer setup:
const launchBrowserCluster = async () => {
try {
const settings = {
headless: true,
args: [
'--no-sandbox',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
],
executablePath: process.env.CHROME_PATH || '/snap/bin/chromium',
};
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency: 10,
puppeteerOptions: settings,
timeout: 10000000,
});
return cluster;
} catch (err) {
console.error('Failed to create browser cluster', err.message);
}
};
I’m running Node.js 18 and using Puppeteer 21.8.0 with puppeteer-cluster 0.23.0. Chromium is installed via Snap.
Any ideas what I’m missing or how to dig deeper into this? I’m totally stumped!
I encountered a similar issue when setting up Puppeteer on Ubuntu. The ‘kill EACCES’ error often points to permission problems. Have you tried running your script with sudo? While not ideal for production, it can help isolate if it’s a permissions issue.
Another thing to check is your Chromium installation. Since you’re using Snap, try uninstalling and reinstalling Chromium:
sudo snap remove chromium
sudo snap install chromium
Also, ensure your Node.js process has the necessary permissions to execute Chromium. You might need to adjust file permissions or ownership of the Chromium binary.
Lastly, consider using a Docker container for your Puppeteer setup. It can help bypass system-level permission issues and ensure a consistent environment across different machines.
I’ve dealt with this exact issue before, and it’s a real pain. One thing that worked for me was switching to the apt version of Chromium instead of using Snap. Try uninstalling the Snap version and installing via apt:
sudo snap remove chromium
sudo apt update
sudo apt install chromium-browser
Then update your executablePath to ‘/usr/bin/chromium-browser’.
If that doesn’t work, check your system’s ulimit settings. Sometimes, the ‘kill EACCES’ error can be related to resource limits. Run ‘ulimit -a’ to see your current limits, and consider increasing them if they’re too low.
Also, make sure you’re not running your script in a directory where your user doesn’t have full permissions. That can sometimes cause weird permission errors with Puppeteer.
Hope this helps! Let us know if you manage to solve it.
hey man, i had tha same problem on ubuntu. try runnin ur script with --no-sandbox
flag. also, check if ur user has permissions to access /tmp directory. sometimes ubuntu restricts it.
if that dont work, try installin chromium-browser package instead of snap version. it worked 4 me. good luck!