Mac安装Dart时,Homebrew报错 Error: Failure while executing

news/2024/11/14 12:18:18/

前言:

最近准备开发Flutter项目时,在安装环境时,安装Homebew时遇到了以下报错信息,在这里分享一下。

报错信息:

~ % brew tap dart-lang/dart
==> Tapping dart-lang/dart
Cloning into '/opt/homebrew/Library/Taps/dart-lang/homebrew-dart'...
fatal: unable to access 'https://github.com/dart-lang/homebrew-dart/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 
Error: Failure while executing; `git clone https://github.com/dart-lang/homebrew-dart /opt/homebrew/Library/Taps/dart-lang/homebrew-dart --origin=origin --template= --config core.fsmonitor=false` exited with 128.

解决方案:

安装 ARM 版 Homebrew
ARM版Homebrew最终被安装在/opt/homebrew路径下。

直接执行:

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"

然后还需设置环境变量,具体操作步骤如下,一定要仔细阅读。

在终端执行命令echo $SHELL获得终端类型:

/bin/zsh => zsh => .zprofile
/bin/bash => bash => .bash_profile

如果看到的是/bin/zsh执行:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)" #brew.idayer.com' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

如果看到的是/bin/bash执行:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)" #brew.idayer.com' >> ~/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"

从macOS Catalina(10.15.x) 版开始,Mac使用zsh作为默认Shell。

Homebrew 安装成功~

~ % brew -v
Homebrew 4.1.7

然后继续执行

 brew tap dart-lang/dartbrew install dart

提示安装失败

~ % brew tap dart-lang/dart
==> Tapping dart-lang/dart
Cloning into '/opt/homebrew/Library/Taps/dart-lang/homebrew-dart'...error: RPC failed; curl 35 LibreSSL SSL_read: Operation timed out, errno 60
fatal: expected flush after ref listing
Error: Failure while executing; `git clone https://github.com/dart-lang/homebrew-dart /opt/homebrew/Library/Taps/dart-lang/homebrew-dart --origin=origin --template= --config core.fsmonitor=false` exited with 128.

再次执行效果:

~ % brew tap dart-lang/dart
==> Tapping dart-lang/dart
Cloning into '/opt/homebrew/Library/Taps/dart-lang/homebrew-dart'...
remote: Enumerating objects: 3684, done.
remote: Counting objects: 100% (1438/1438), done.
remote: Compressing objects: 100% (437/437), done.
remote: Total 3684 (delta 1185), reused 1199 (delta 995), pack-reused 2246
Receiving objects: 100% (3684/3684), 671.61 KiB | 54.00 KiB/s, done.
Resolving deltas: 100% (2461/2461), done.
Tapped 22 formulae (53 files, 857.5KB).

安装成功啦!!!!

然后安装

~ % brew install dart
==> Fetching dart-lang/dart/dart
==> Downloading https://storage.googleapis.com/dart-archive/channels/stable/release/3.1.
############################################                                       54.8%curl: (56) LibreSSL SSL_read: Connection reset by peer, errno 54Error: dart: Failed to download resource "dart"
Download failed: https://storage.googleapis.com/dart-archive/channels/stable/release/3.1.0/sdk/dartsdk-macos-arm64-release.zip

又出现报错信息了

那我们再次尝试一下呢

这次就很快安装成功了

brew install dart
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api/formula.jws.js
##O#- #                                                                                
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api/cask.jws.json
##O#- #                                                                                
==> Fetching dart-lang/dart/dart
==> Downloading https://storage.googleapis.com/dart-archive/channels/stable/release/3.1.
################################################################################# 100.0%
==> Installing dart from dart-lang/dart
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences.If that doesn't show you any updates, run:sudo rm -rf /Library/Developer/CommandLineToolssudo xcode-select --installAlternatively, manually download them from:https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.2.==> Caveats
Please note the path to the Dart SDK:/opt/homebrew/opt/dart/libexec
==> Summary
🍺  /opt/homebrew/Cellar/dart/3.1.0: 987 files, 554.3MB, built in 6 seconds
==> Running `brew cleanup dart`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

安装环境的时候和网络也有一定的关系,我们可以多试两次

我们我们测试一下安装成功没

~ % dart --version
Dart SDK version: 3.1.0 (stable) (Tue Aug 15 21:33:36 2023 +0000) on "macos_arm64"

👌👌👌


http://www.ppmy.cn/news/1084343.html

相关文章

Prometheus-Rules(规则)

文章目录 一、介绍二、配置 Prometheus 使用规则文件三、 规则文件语法规则文件语法全局Recording rules(记录规则)2 Alerting rules(警报规则)3 模板化如何使用四、检查规则文件语法五、发送警报通知一、介绍 Prometheus规则是一种逻辑表达式,可用于定义有关监控数据的逻…

1921. 消灭怪物的最大数量

原题地址 解法一 排序贪心即可。思想为先计算出每一个怪兽到达城市的时间,然后排序,有小到大进行消灭,此时的下标可视作时间。当怪兽到达城市的时间超过或等于当前时间时,即已经到达了城市,游戏失败,下标…

8月琐碎但值得的事情

8月份结束了,最近心态比较好,慢点就慢点,没有那么着急了,可能是因为着急也没啥办法, 8月是比较开心的一个月,可能是做的事情更有盼头了,可能是看了喜欢的书,可能是我变瘦了&#xff…

03-使用一个不可变对象作为key,红黑树怎么比较大小?

使用一个不可变对象作为key,红黑树怎么比较大小? 答:Java 中的红黑树是通过左旋、右旋的方式来维护树的平衡性,而左旋、右旋又依赖于节点大小的比较。对于使用不可变对象作为key实际上是可以的,因为比较key的大小本身…

c++入门一

参考:https://www.learncpp.com/cpp-tutorial/ When you finish, you will not only know how to program in C, you will know how NOT to program in C, which is arguably as important. Tired or unhappy programmers make mistakes, and debugging code tends…

【小沐学Python】UML类图的箭头连线关系总结(python+graphviz)

文章目录 1、简介1.1 类图1.2 Graphviz 2、Graphviz2.1 安装2.2 命令行测试2.3 python测试 3、关系3.1 实现3.2 泛化3.3 关联3.4 依赖3.5 聚合3.6 组合 结语 1、简介 UML(unified modeling language,统一建模语言)是一种常用的面向对象设计的…

23062day6

作业:将dict.txt导入到数据库中。 方法1:创建shell脚本, 调用指令创建数据库和表格,使用循环在循环中用数组存储dict.txt的内容并插入表格中。 方法2:在终端创建数据库和表格,将dict.txt中的内容手动输入…

Python项目打包与部署(1):模块与包的概念与关系

虽然 Python 是动态类型编程语言,不需要提前编译。但1个Python项目也是由一组.py文件、数据文件、资源文件等组成,大部分项目还会引用第3方库,也存在依赖管理。因此,python项目管理与其它语言如java,C是类似的。而构建…