Error: Failed to launch the browser process puppeteer

Abu Dujana Mahalail picture Abu Dujana Mahalail · Jan 30, 2020 · Viewed 17.9k times · Source

checked failed crashForExceptionInNonABIComplianceCodeRange the code below its functon is to create PDF file

   (async function() {

      try {

      const browser = await puppeteer.launch();
      const page = await browser.newPage();

      await page.setContent(pdfOutput);
      await page.emulateMedia("screen");
      await page.pdf({
        path: "routes/planiton/pdf/mypdf.pdf",
        format: "A4",
        printBackground: true
      });

      console.log('done');
      await browser.close();
      //process.exit();

    } catch (e) {
      console.log("Our Error", e)
    }
  })();

Answer

JULIEN PICARD picture JULIEN PICARD · Jul 28, 2020

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 :)