我一直在尝试编写几个月前编写的代码,但遇到了以下错误,
> puppeteer@5.5.0 install /Users/xyz/Documents/xyz.github.io/node_modules/puppeteer
> node install.js
The chromium binary is not available for arm64:
If you are on Ubuntu, you can install with:
apt-get install chromium-browser
/Users/xyz/Documents/xyz.github.io/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:112
throw new Error();
Error
at /Users/xyz/Documents/xyz.github.io/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:112:19
at FSReqCallback.oncomplete (node:fs:194:21)
由于某种原因 puppeteer 似乎无法识别 Chromium arm64。上述任何解决方法?我尝试过的解决方案:
https://github.com/puppeteer/puppeteer/issues/6622
最佳答案
通过 50b810d 修复.全新安装 Node 模块
在终端 sudo nano ~/.zshrc
中键入以下内容& 节省。
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=`which chromium`
rm -rf node_modules/
rm -rf package-lock.json
rm -rf .cache
npm i
补丁有效。
----- 更新 ------------- (27/04/2021)
确保你已经安装了 Chrome 。如果你还没有听从@Rocco 的建议
brew install --cask chromium
.----- 更新 ------------- (18/11/2021)
Hajonsoft更新了 github 上的线程 - https://www.courier.com/blog/tips-and-tricks-to-setup-your-apple-m1-for-development虽然这对于大多数开发人员和依赖项/工具来说可能是一个很好的修复,但请注意 rosetta emulation is not available in certain regions自己在东南亚验证过。
关于node.js - puppeteer@5.5.0 安装 : `node install.js` on M1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65928783/