puppeteer: Error: Failed to launch the browser process! spawn chrome.exe ENOENT

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 3.0.0
  • Platform / OS version: Windows 10 x64 1909
  • URLs (if applicable):
  • Node.js version: v14.0.0-v8-canary20200415b958dfb8bf

What steps will reproduce the problem?

Please include code that reproduces the issue.

  1. There is a codebase which works perfectly with Puppeteer 2.1.1
  2. Upgrade Puppeteer to 3.0.0 via package.json: "puppeteer": "^3.0.0". That’s the only change I applied.
  3. Try to generate a PDF.

Puppeteer initialization:

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

What is the expected result? A PDF should be generated.

What happens instead?

(node:12196) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! spawn C:\Users\User\PROJ\node_modules\puppeteer.local-chromium\win64-737027\chrome-win\chrome.exe ENOENT

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md

at onClose (C:\Users\User\PROJ\node_modules\puppeteer\lib\Launcher.js:615:20)
at ChildProcess.<anonymous> (C:\Users\User\PROJ\node_modules\puppeteer\lib\Launcher.js:607:71)
at ChildProcess.emit (events.js:315:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
at onErrorNT (internal/child_process.js:468:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

(node:12196) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:12196) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 26
  • Comments: 40 (4 by maintainers)

Most upvoted comments

For me on Linux, the only way to resolve is by installing some dependencies:

sudo apt-get update
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.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
sudo apt-get install -y libgbm-dev

Source

@dance2die, I’ve just removed puppeteer 3.0.0 from the package.json, refreshed node modules installation, then readded puppeteer 3.0.4 to the package.json and installed. Everything is OK.

I had the same issue as @aiden-sobey.

I’m trying to use pageres-cli and I keep getting this error: Failed to launch the browser process! spawn /usr/bin/chromium-browser

It does not matter what I set for PUPPETEER_EXECUTABLE_PATH in my ~/.zshrc file on my M1 Macbook, the error message never changes. So, I assumed that path must be hardcoded somewhere.

Sure enough, through some grepping I found the culprit: node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js

If I change the path to what I’m showing below (from /usr/bin/chromium-browser), pageres works immediately.

        if (os.arch() === 'arm64') {
            chromeExecutable = '/Applications/Chromium.app/Contents/MacOS/Chromium';
        }

for me my solution is fuck the code.i deleted all and it works now.

Please unpublish this version, newbies on MacOS can’t install puppeteer now and have an issues in CI, it simply not work 😄

For me on Linux, the only way to resolve is by installing some dependencies:

sudo apt-get update
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.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
sudo apt-get install -y libgbm-dev

This worked for me as well, thx @tiagoboeing

Thanks very much for your help @tiagoboeing , but still unsuccessful. What I tried:

  1. Install chromium using brew (as described in your #6622 comment)
  2. Export env variables to skip downloading chromium with puppeteer
  3. Installed my package with a puppeteer dependency successfully!
  4. Ran export PUPPETEER_EXECUTABLE_PATH=/Applications/Chromium.app/Contents/MacOS/Chromium to reference chromium installed by brew
  5. Tried to run my package that depends on puppeteer
  6. Received:
Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/Users/aiden/.nvm/versions/node/v14.16.0/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
    at ChildProcess.<anonymous> (/Users/aiden/.nvm/versions/node/v14.16.0/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:185:85)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:467:12)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

I’m curious if it’s reading the puppeteer environment variable in properly, as it doesn’t reference it in the error message… Will keep trying, and thanks again for your help.

Note: Tried referencing chromium in my Applications and in the which chromium directory, neither were successful.

On windows i noticed the zip file wasn’t not unzipped correctly, which results in a chome-win directory with only the manifest file.

@aiden-sobey on MacOS with M1 chip I solved (on Stencil, he uses Puppeteer) adding executablePath to my Chromium path:

See this line I’m checking by OS and adding the executable path.

Using only Puppeteer we’ve something like that:

const browser = await puppeteer.launch({ executablePath: '/path/to/Chrome' });

Extracted from README on Default runtime section.

You need to install Chromium and keep it in Applications folder if possible.

I dunno, that makes sense for your case? Can you try it?

Upgrade puppeter to last version. Fixed the problem on macbook pro m1 chip

So how can I fix this in Windows? I’ve just installed this with npm i puppeteer and I’m getting this error. When I check the path:

\node_modules\puppeteer\.local-chromium\win64-856583\chrome-win\

I see there is no “chrome.exe”. The folder has only “90.0.4427.0.manifest” file. Can someone reopen this or should I report a new bug?

EDIT: Problem resolved by updating to the last Node 14.16.1 LTS (I had 14.0.0 before)

I have the same problem

Error: Failed to launch the browser process! spawn C:\Program Files\Google\Chrome\Application\chrome.exe ENOENT

node 18.13.0, windows 10 chrome located at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

SOLVED I manually added string __classPrivateFieldSet(this, _BrowserRunner_executablePath, "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "f"); instead of __classPrivateFieldSet(this, _BrowserRunner_executablePath, executablePath, "f"); in BrowserRunner.js

For me on Linux, the only way to resolve is by installing some dependencies:

sudo apt-get update
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.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
sudo apt-get install -y libgbm-dev

Source

Thanks, this worked for me.

@agileadam’s has the final fix necessary to make m1 work – if you’ve already installed the m1 chromium workaround via Brew.

In order to get https://github.com/artpi/roam-research-private-api/issues/15 working, I ended up patching the os.arch() at the following path, homebrew/lib/node_modules/roam-research-private-api/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js.

chromeExecutable = '/opt/homebrew/bin/chromium';

  • The location of your puppeteer srccode will vary depending on what you’re patching
  • Locate your chromeExecutable via which chromium

Everything works as expected after that. Thanks for getting down to the nuts & bolts @agileadam!