Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pubmikeb opened this issue Apr 16, 2020 · 40 comments
Closed

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

pubmikeb opened this issue Apr 16, 2020 · 40 comments

Comments

@pubmikeb
Copy link

pubmikeb commented Apr 16, 2020

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.

@pubmikeb pubmikeb changed the title Error: Failed to launch the browser process! spawn \node_modules\puppeteer\.local-chromium\win64-737027\chrome-win\chrome.exe ENOENT Error: Failed to launch the browser process! spawn chrome.exe ENOENT Apr 16, 2020
@munrocket
Copy link
Contributor

munrocket commented Apr 19, 2020

Same after update to puppeteer@3.0.0 @jackfranklin

Platform: Github Actions, Ubuntu 18.04
Node version: 10.x

What steps will reproduce the problem?

git clone https://github.com/mrdoob/three.js
npm un puppeteer && npm i -D puppeteer@3.0.0
npm install
npm run test-e2e webgl_animation_keyframes

What happens instead?

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

    at onClose (/home/runner/work/three.js/three.js/node_modules/puppeteer/lib/Launcher.js:615:20)
    at Interface.helper.addEventListener (/home/runner/work/three.js/three.js/node_modules/puppeteer/lib/Launcher.js:605:56)
    at Interface.emit (events.js:203:15)
    at Interface.close (readline.js:397:8)
    at Socket.onend (readline.js:173:10)
    at Socket.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:2839) 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(). (rejection id: 1)
(node:2839) [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.

@christian-bromann
Copy link
Contributor

Seems like a duplicate of #5656

@munrocket
Copy link
Contributor

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

@jackfranklin
Copy link
Collaborator

@munrocket this issue specifically talks about Windows issue, please open a new issue if you're getting errors on Mac.

@munrocket
Copy link
Contributor

It’s not my issue, I am just sitting in puppeteer community. Here same problem in CI also #5704

@jdalrymple
Copy link

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

@pubmikeb
Copy link
Author

For me this issue is solved.
The ticket can be closed.

@dance2die
Copy link

@pubmikeb What was the fix?

@pubmikeb
Copy link
Author

@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.

@cindyloo
Copy link

cindyloo commented Nov 2, 2020

@0xkobe
Copy link

0xkobe commented Nov 3, 2020

I used to have problem for CI/CD of headful chrome extension testing and finally resolved with this package
https://github.com/mujo-code/puppeteer-headful
It also has docker file of headful setup process and this link would be helpful.

@tiagoboeing
Copy link

tiagoboeing commented Nov 23, 2020

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

@drilonibrahimi
Copy link

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

@Iswaryasl
Copy link

@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.

Facing the same issue after updating to 3.0.4

MAC Os version: 10.9.5
Node : v12.11.0
npm :6.11.3

@aiden-sobey
Copy link

Getting this issue on MacOS with an M1 chip.
Mac OS version: 11.2
Node: v15.12.0
NPM: v7.8.0

@tiagoboeing
Copy link

tiagoboeing commented Apr 6, 2021

@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?

@aiden-sobey
Copy link

Thanks @tiagoboeing . Problem is I'm trying to use an NPM package that relies on puppeteer, so I can't alter the source code myself. My issue seems to be closely linked to #6622 , but it's all a bit strange as it all worked fine last week.

@tiagoboeing
Copy link

tiagoboeing commented Apr 6, 2021

@aiden-sobey maybe you can use as workaround a environment variable to specify Puppeteer path on execution time. I'm looking for this. You need to test it, I'm only looked at sources.

From sources

process.env.PUPPETEER_EXECUTABLE_PATH ||

* **NOTE** `puppeteer.executablePath()` is affected by the `PUPPETEER_EXECUTABLE_PATH`

Can helpful

On mentioned issue you try this solution? #6622 (comment)

@aiden-sobey
Copy link

aiden-sobey commented Apr 6, 2021

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

  1. Install chromium using brew (as described in your Installation fails on Apple Silicon / M1 #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.

@Juraj-Masiar
Copy link

Juraj-Masiar commented Apr 21, 2021

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)

@nfaltir
Copy link

nfaltir commented Apr 26, 2021

Backstopjs is executing, but this error keeps occurring when running this command "backstop reference"

COMMAND | Executing core for "reference"
clean | backstop_data/bitmaps_reference was cleaned.
createBitmaps | Selected 14 of 14 scenarios.
COMMAND | Command "reference" ended with an error after [0.007s]
COMMAND | Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT

System: Mac M1
Node: V16.0.0
BackstopJS: v5.3.2

Any help is greatly appreciated!

@diogomartino
Copy link

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
Copy link

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';
        }

@Quezion
Copy link

Quezion commented Jan 4, 2022

@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 artpi/roam-research-private-api#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!

@andirsun
Copy link

andirsun commented Aug 1, 2022

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

@grassfedavocado
Copy link

I am so confused as to how I had this issue in 2022 and am here looking at this forum all bc i wanted to run a console logger on headless mode on a server.

@xuantiep
Copy link

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

@paragrudani1
Copy link

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

Worked for me as well

@ShnAlmighty
Copy link

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

Originally posted by @tiagoboeing in #5662 (comment)

I guess some of these packages are not present in alpine based systems, is there something similar for alpine based systems?

@Chetan77verma
Copy link

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

got Unable to locate package libcairo this error

after changing this libcairo -> libpangocairo-1.0-0 worked for me

@althaf004
Copy link

My node version is 18.12.1.
using WSL

getting error as below.

image

Thanks

@Vlad78
Copy link

Vlad78 commented Jan 25, 2023

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

@althaf004
Copy link

My node version is 18.12.1. using WSL

getting error as below.

image

Thanks

i was able to fix this issue, by adding the broswer url in /usr/bin/google-chrome after installing chrome.

Install Google Chrome in your WSL sandbox ( ref: https://scottspence.com/posts/use-chrome-in-ubuntu-wsl)
Give WSL sand box Chrome path in ChatGPT configuration
When you click chaGPT icon it prompt for login and it may ask for captcha verification
chatGPT Icon
Login
Settings update with your credentials
After successful login yo can use this in your VSC

@fransappia01
Copy link

this works for me locally:
puppeteer.launch({ignoreDefaultArgs: ['--disable-extensions'], args: ['--no-sandbox','--disable-setuid-sandbox'], headless: 'new'})

const client = new Client({
clientId: "client-o",
puppeteer: {
args: ['--no-sandbox','--disable-setuid-sandbox'],
ignoreDefaultArgs: ['--disable-extensions'],
ignoreHTTPSErrors: true,
defaultViewport: null,
// Ignorar propiedades y funciones específicas durante la evaluación
// para evitar errores
ignoreDefaultViewport: true,
ignoreCache: true,
extraHTTPHeaders: {
'Accept-Language': 'en'
},
executablePath: '.cache\puppeteer\chrome\chrome.exe',
headless: 'new',
devtools: false,
userDataDir: null
}
});

but how i can execute the browser inside my project folder? i want to deploy it and i can't.

@atanu20
Copy link

atanu20 commented Oct 12, 2023

for me

first create puppeteer.config.cjs in root dir

const {join} = require('path');


/**

* @type {import("puppeteer").Configuration}

 */

module.exports = {

cacheDirectory: join(__dirname, '.cache', 'puppeteer'),

};

then

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

@atanu20
Copy link

atanu20 commented Dec 4, 2023

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

in root dir create " .puppeteerrc.cjs "

`const {join} = require('path');

/**

  • @type {import("puppeteer").Configuration}
    */
    module.exports = {
    cacheDirectory: join(__dirname, 'node_modules', '.puppeteer_cache'),
    };
    `

"puppeteer": "^21.0.3",

if its not working then install some packages

`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
`

@atanu20
Copy link

atanu20 commented Dec 4, 2023

const pupOpts = { headless: false, executablePath:${process.env.CHROME_PATH}, env: { DISPLAY: ':0', }, args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--no-zygote', ], }

@rudiedirkx
Copy link

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

This still happened to me just now. Puppeteer is installed, and chrome-linux.zip is downloaded, and unzipped, but incorrectly (and not a peep about that), and then you have a broken chrome. But where's the fault? Corrupt download? Bad zip file? Broken local unzip process?

@atanu20
Copy link

atanu20 commented Dec 29, 2023

If u are running this puppeteer in local just install 21.0.3 version and const browser = await puppeteer.launch({ headless: true, args:['--no-sandbox'] });

@d1ms
Copy link

d1ms commented Apr 10, 2024

I solved this issue for replace "" on to "/" in the executablePath.
executablePath: "C:/Program Files/Google/Chrome/Application/chrome.exe"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests