Error: Failed to launch the browser process puppeteer

apt-get install chromium-browser

Try with this command and still you get any error .

Then install some incomplete packages of the os. For Ubuntu I installed:

sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

I had the same issue, I tried everything which is listed from the Puppeteer guide, none of them worked for me.

What works for me was to download chromium manually sudo apt-get install chromium-browser.

And then, tell Puppeteer where chromium is located :

const browser = await puppeteer.launch({
  executablePath: '/usr/bin/chromium-browser'
})

Hope this will help someone :)


const browser = await puppeteer.launch({
    headless:false,
    args: ["--no-sandbox"]
});

install puppeteer and puppeteer-core.


-On Linux (Ubuntu)V20 -using Node v12.X -using Puppeteer-core v10.0.0

https://pptr.dev/#?product=Puppeteer&version=v10.0.0&show=api-class-browserfetcher https://openbase.com/js/puppeteer-core/versions#10.0.0 -- for r[Version]

puppeteer = require('puppeteer-core');
// console.log('TRYING TO FETCH BROWSER')
const browserFetcher = puppeteer.createBrowserFetcher();
let revisionInfo = await browserFetcher.download('884014');


browser = await puppeteer.launch(
  {
    executablePath: revisionInfo.executablePath,
    args: ['--no-sandbox', "--disabled-setupid-sandbox"]
  }
)

you might get an error on a server if your running as Root and you did not set the --no-sandbox flag

if you get error like:

/home/[xxx]/[xxx]/node_modules/puppeteer[-core]/.local-chromium/linux-[xxx]/chrome-linux/chrome: error while loading shared libraries: xxxx-xxxx.xx.x: cannot open shared object file: No such file or directory

on your shell, cd to /home/[xxx]/[xxx]/node_modules/puppeteer[-core]/.local-chromium/linux-[xxx]/chrome-linux/chrome, check missing dependencies with => ldd chrome | grep not

if you get a list then run the following commands

apt-get upgrade
apt-get update
apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

apt-get install -y libgbm-dev
apt-get install libglib2.0-0

if the dependencies are gone then your puppeteer should work fine