node.jspuppeteer

Error: Failed to launch the browser process puppeteer


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)
    }
  })();

Solution

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