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.
- There is a codebase which works perfectly with Puppeteer 2.1.1
- Upgrade Puppeteer to 3.0.0 via package.json:
"puppeteer": "^3.0.0"
. That’s the only change I applied. - 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)
For me on Linux, the only way to resolve is by installing some dependencies:
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.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 😄
This worked for me as well, thx @tiagoboeing
Thanks very much for your help @tiagoboeing , but still unsuccessful. What I tried:
export PUPPETEER_EXECUTABLE_PATH=/Applications/Chromium.app/Contents/MacOS/Chromium
to reference chromium installed by brewI’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:
Extracted from README on Default runtime section.
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: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.jsThanks, 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';
which chromium
Everything works as expected after that. Thanks for getting down to the nuts & bolts @agileadam!