Installation fails on Apple Silicon / M1
See original GitHub issueSteps to reproduce
- Puppeteer version: 5.5.0
- Platform / OS version: macOS Big Sur 11.0.1 (Apple Silicon)
- Node.js version: 15.2.1
What steps will reproduce the problem?
- Install
puppeteerusingyarnornpm
What is the expected result?
puppeteer gets installed
What happens instead? Installation fails.
error path-to-project/node_modules/puppeteer: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: path-to-project/node_modules/puppeteer
Output:
The chromium binary is not available for arm64:
If you are on Ubuntu, you can install with:
apt-get install chromium-browser
path-to-project/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:112
throw new Error();
^
Issue Analytics
- State:
- Created 3 years ago
- Reactions:124
- Comments:52 (2 by maintainers)
Top Results From Across the Web
If an error occurred while updating or installing macOS
The message might say that an error occurred while downloading, preparing, or installing, or that the installer is damaged or could not be ......
Read more >M1 Apple Silicon pkg installation failed - Jamf Nation Community
The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
Read more >cannot install edgeR on M1 Mac
I am trying to install Rhtslib on macOS Big Sur M1 using R 4.1.0. But I get the following error. And this problem...
Read more >Restoring Apple Silicon M1 Macs Leading to macOS ...
Several customers who purchased a new Mac with an M1 Apple Silicon app have discovered an issue when attempting to restore the machine, ......
Read more >Install on Mac | Docker Documentation
Docker Desktop for Apple silicon for detailed information about Docker Desktop for Apple silicon. Troubleshooting describes common problems, workarounds, how to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found

The solution for me using Chromium from Homebrew was:
You will get a security warning. Close it and go to
System Preferences>Security & Privacy>Generaland clickOpen anyway.Quit Chromium.
To
~/.zshrcadd:Then restart your terminal.
Edit: Thanks to @gwuah for clarifying that you may need to upgrade Puppeteer.
puppeteer: ^9.1.1should work.A combination of steps from @chetbox and @Lxstr just worked for me. It involved creating a fork of
puppeteerand changing a single line of source code. Here’s the exact steps for my project, in~/Documents/my-project, where trying to installpuppeteergives me the following error:export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true. This will allowpuppeteerto install.npm install puppeteer. It will skip trying to download chromium and install correctly.npm run test) gives the following error:brew install chromium. Runwhich chromiumto make sure it installed properly, it should output the path to the new Chromium executable.In Terminal, run:
Running
export PUPPETEER_EXECUTABLE_PATHdid not work for me on its own. This is becausepuppeteercurrently hard-codes/usr/bin/chromium-browserinLauncher.ts(compiled toLaunched.js) if it detects you’re onarm64. It doesn’t even bother to check the environment variables.This is where I needed to fork puppeteer. I cloned it to
~/Documents/puppeteerand created a new branch.~/Documents/puppeteer/src/node/Launcher.ts. Line 180 shows:This is where problem is with the hard-coded path. It immediately assumes where
chromium-browseris located, which (at least for me) is not the case with Homebrew installs on Big Sur. Theelsepart of this statement is where it checks your environment variables for configuration (likePUPPETEER_EXECUTABLE_PATH), but it never gets there if you’re onarm64.By skipping this
os.arch() === 'arm64'check, we forcepuppeteerto look for the environment variables. I just changed line 180 to below:Now we need to link our “forked”
puppeteerto our original project. First installpuppeteerdependencies…~/Documents/puppeteer, runnpm installto install everything puppeteer needs. Make sure yourexport PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=trueis still set.npm run tscto use the script inpuppeteer’spackage.jsonto compile the TypeScript. You need recompile anytime you make a change to the source code in~/Documents/puppeteer.npm linkto create a global npm “symlink” to your~/Documents/puppeteer.~/Documents/my-project.npm link puppeteerto pointmy-projectto your forked version ofpuppeteer.npm run testagain, and everything should work! As @chetbox suggested, you might add these to your~/.zshrc~to make sure your environment variables are set correctly when you re-open Terminal: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
puppeteeritself, so hopefully we get a real fix in a release soon. For anyone else that can’t wait for a release to run their tests, I hope this is a viable option without having to change anything in your own project.