-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Installation fails on Apple Silicon / M1 #6622
Comments
So there is no way to run Puppeteer in M1 Mac? @stnwk did you find any solution? |
I got Puppeteer to work just fine on M1 by providing the Chromium binary myself from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/818858/ (it's the Intel build, but runs fine via Rosetta 2 – get Due to the bug described in #6634, I also had to make a minor code adjustment in the launcher, see joshuajung@7987b91. |
@gijo-varghese It works OOTB with Rosetta. I did not have to change anything. |
@steida how did you install Puppeteer via Rosetta? |
@gijo-varghese Nothing special, Node.js 12 and 14 is installed via nvm. The problem is Node 15, which is arm compiled and then it requires Chromium ARM. |
Yup, what @steida says above. As long as you are running Node (or your whole shell) via Rosetta, Puppeteer doesn't even notice it's on ARM and is happy. Once you use an ARM Node however (>= 15, built on an ARM Mac), you run into #6634 and need to supply Chromium yourself. Chromium can still be an Intel build, but Puppeteer will struggle to install and/or find it. For a workaround, see #6622 (comment). |
I'm using node v12 running terminal (also tried iterm) but running in Rosetta 2. |
I found the issue I was having and hopefully it can help others. Since this is day 1 on the m1, I installed as brew as arm in |
Hello @joshuajung . I am downloaded the chrome-mac.zip from the link you have provided and unzipped it to the root of my project. Then I did
But this gets me an error |
You probably didn't patch Launcher.ts as described in joshuajung@7987b91 yet (still required until the fix for #6634 is released). |
Thanks for all the helpful tips in the previous posts. For anyone else looking for more explicit instructions, this is what finally got things working for me: Create a "Rosetta Terminal" (https://osxdaily.com/2020/11/18/how-run-homebrew-x86-terminal-apple-silicon-mac/) and install brew, node and yarn in this new terminal.
|
I'm having the same issue on a Raspberry Pi4 (also has arm64 chip). Found this workaround (https://samiprogramming.medium.com/puppeteer-on-raspbian-nodejs-3425ccea470e) when running the 32bit os, but it fails when running the 64bit Raspian beta. Managed to get puppeteer installed by using PUPPETEER_SKIP_CHROMIUM_DOWNLOAD, but still get this error, (node:17769) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT Puppeteer is using the path "/usr/bin/chromium-browser", but my launch config is "executablePath: '/usr/bin/chromium'" I know this is a Mac thread, but this discussion is the closest I've seen to my issue. Thanks! |
This is what I've tried (after many circles) and installs but still doesn't run Then find this file Replace line 54 with See |
It finally works when I follow the variable down the line and replace line 79 or BroswerRunner.js
|
Just curious whether this is planned to be ever fixed. |
why is this closed? It does not work today |
The solution for me using Chromium from Homebrew was: brew install chromium
`which chromium` You will get a security warning. Close it and go to Quit Chromium. To export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=`which chromium` Then restart your terminal. Edit: Thanks to @gwuah for clarifying that you may need to upgrade Puppeteer. |
A combination of steps from @chetbox and @Lxstr just worked for me. It involved creating a fork of
Running This is where I needed to fork puppeteer. I cloned it to
if (os.arch() === 'arm64') {
chromeExecutable = '/usr/bin/chromium-browser';
} .... This is where problem is with the hard-coded path. It immediately assumes where By skipping this if (false) {
chromeExecutable = '/usr/bin/chromium-browser';
} .... Now we need to link our "forked"
Hopefully this helps someone else from spending the many hours that I did trying to get this to work. This seems like it would be a pretty simple fix in |
Following on from the great tips above, you can pass the const browser = await puppeteer.launch({
executablePath: '/opt/homebrew/bin/chromium',
}) This saved me from having to do the fork/code change steps (step 6 onwards). |
Same as puppeteer#6914 but with a different commit message. With this change, we don't need to patch puppeteer on M1. See puppeteer#6622.
Google has published Chromium builds for Apple Silicon so we can fetch it now Related to #6622
As of Big Sur 11.6.7, the control panel has changed. If you're using the standard Apple Terminal, you should be good to go. But who uses that? :-) I'm using iTerm. Here's what worked for me:
|
Can anyone share a working Dockerfile using I'm building on an M1 using
The expected arm64 build for Does anyone have this working with the new native binaries? Or, am I misinterpreting the point of that env var and it's only for running natively on an M1 mac directly rather than within a Linux based docker file? |
To delete the quarantine attribute: |
set |
@ReDrUm you should not use |
I had this error message: ...
/Users/usern_name/path_to_repo/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193
reject(new Error([
^
Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
... I solved this problem by doing this:
$ brew install chromium
$ which chromium
/opt/homebrew/bin/chromium
Worked for the |
Another solution that does not require rebuilding the puppeteer project is to use I just replace this in the
with:
Here are the paths to the launcher files in my After that you can run If you include a
This will automatically apply with npm installs. This should make a commit-able change that you can push to your repo. Now anyone with an M1 will just need to add the env vars specified above to your shell rc file and make sure you installed chromium locally and you should be up and going.
It is worth noting that this patch will only work as long as it does not conflict with what the maintainers have changed in future versions. It will tell you when the patch fails to apply in the future and you will have to go fix it yourself again manually. |
Why is this issue closed? Puppeteer still doesn't work on an M1... (v19.6.3) Running |
If you can, move to Playwright. You won't be looking back. |
This commit makes screenshot tests work on macOS running on Apple silicon, but adds Chromium as an external dependency for running them. See puppeteer/puppeteer#6622 for more details.
This commit makes screenshot tests work on macOS running on Apple silicon at the cost of adding Chromium as an external dependency. See puppeteer/puppeteer#6622 for more details.
Just follow the article. This is simple fix |
This is even more complicated if you're trying to support local and Docker workflows multi-arch. |
brew install chromium --no-quarantine I found the above line on reddit. So take with a grain of salt, but this was necessary to get |
Mac OS Here is my working solution using puppeteer's native chromium instead of installing your own:
|
Steps to reproduce
What steps will reproduce the problem?
puppeteer
usingyarn
ornpm
What is the expected result?
puppeteer
gets installedWhat happens instead?
Installation fails.
The text was updated successfully, but these errors were encountered: