question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Failed to launch the browser process! spawn /app/node_modules/puppeteer/.local-chromium/linux-756035/chrome-linux/chrome ENOENT

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: ^3.3.0
  • Platform / OS version: Ubuntu 20.04 LTS
  • URLs (if applicable):
  • Node.js version: 12.16.1

What steps will reproduce the problem?

I know there’s a lot of issues like this one, but I tried every solutions I saw, such as add args to the .launch, reinstall all required dependencies, reinstall puppeteer, reinstall Chromium, try Chrome… But I still get this error.

  1. In backend : `const puppeteer = require(‘puppeteer’); const router = require(‘express’).Router();

router.get(‘/create’, async (req, res) => { console.log(“BEGINING PDF CREATION PROCESS”); try { // Starting browser and got to a new page const browser = await puppeteer.launch({ headless: true }); const page = await browser.newPage(); await page.goto(‘https://google.com’); // Define the media type await page.emulateMediaType(‘screen’); // Create PDF with custom options const buffer = await page.pdf({ format: ‘A4’, printBackground: true, preferCSSPageSize: true }); // Send PDF to front res.writeHead(200, { ‘Content-Type’: ‘application/pdf’, ‘Content-Length’: buffer.length }); res.end(buffer); // Close browser await browser.close() console.log(“ENDING PROCESS SUCCESSFULY”); } catch (error) { console.log(“ENDING PROCESS UNSUCCESSFULY”); console.log(error); } });

module.exports = router2. frontend :axios({ method: ‘get’, url:‘/pdf/create’ }) .then(res => { console.log(“Response received”) return res .arrayBuffer() .then(res => { const blob = new Blob([res], { type: ‘application/pdf’ }) saveAs(blob, ${order._id}.pdf) }) .catch(error => console.log(error)) })` 3.

What is the expected result? It should send the PDF buffer to the front.

What happens instead? I returns the error above.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:12

github_iconTop GitHub Comments

14reactions
mweitzelcommented, Jun 17, 2020

@qiaochunmei 这解决了问题. 祝好运.

unzip node_modules/puppeteer/.local-chromium/chrome-mac.zip
cp -r chrome-mac/Chromium.app/ ./node_modules/puppeteer/.local-chromium/mac-756035/chrome-mac/Chromium.app/
2reactions
johns10commented, Apr 29, 2021

The error I was getting was: spawn D:\Users\johns10\Documents\GitHub\userdocs_umbrella\apps\userdocs_web\assets\dist\win-unpacked\resources\app.asar\node_modules\puppeteer\.local-chromium\win64-856583\chrome-win\chrome.exe ENOENT

I solved it like this:

async function openBrowser() {
  if (isDev) {
    var executablePath = puppeteer.executablePath()
  } else {
    var executablePath = puppeteer.executablePath().replace("app.asar", "app.asar.unpacked")
  }
  const browser = await puppeteer.launch({ executablePath: executablePath });

  return browser
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Failed to launch the browser process! spawn chrome ...
Tried to run my package that depends on puppeteer; Received: Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT ...
Read more >
Error: Failed to launch the browser process puppeteer
What works for me was to download chromium manually sudo apt-get install chromium-browser . And then, tell Puppeteer where chromium is located :...
Read more >
Troubleshooting - Puppeteer
Starting from v19.0.0, Puppeteer will download browsers into ~/.cache/puppeteer ... Error: Failed to launch chrome! spawn /usr/bin/chromium-browser ENOENT.
Read more >
Fix this error when using Puppeteer on Lambda - YouTube
Failed to launch the browser process - Fix this error when using Puppeteer on ... with chrome-aws-lambda, you are likely seeing this error....
Read more >
Failed to launch the browser process! puppeteer - YouTube
node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found