Command exited with code 128: git fetch --tags

2023年4月11日 574点热度 0人点赞 0条评论

在 macOS 中运行 doctor 时,多数情况下会出现以下错误,如 LibreSSL SSL_read、Android license status unknown、Unable to find bundled Java version、HTTP Host Availability等,我们一个个看,看看如何解决这些问题。

问题识别

xxx@xxxMacBook-Pro ~ % flutter doctor
Command exited with code 128: git fetch --tags
Standard error: fatal: unable to access
'https://github.com/flutter/flutter.git/': LibreSSL SSL_read:
error:02FFF03C:system library:func(4095):Operation timed out, errno 60


Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.7.0, on macOS 12.6.3 21G419 darwin-x64, locale
    zh-Hans-CN)
    ! Warning: `dart` on your path resolves to
      /usr/local/Cellar/dart/2.2.0/libexec/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/em_er/development/flutter. Consider
      adding /Users/em_er/development/flutter/bin to the front of your path.
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.5)
[✓] VS Code (version 1.76.1)
[✓] Connected device (3 available)
HTTP Host availability check is taking a long time...[!] HTTP Host Availability
    ✗ HTTP host "https://maven.google.com/" is not reachable. Reason: An error
      occurred while checking the HTTP host: Connection terminated during
      handshake
    ✗ HTTP host "https://cloud.google.com/" is not reachable. Reason: An error
      occurred while checking the HTTP host: Operation timed out

! Doctor found issues in 5 categories.

解决方法

在终端使用代理访问

export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

将上面复制到终端执行(地址为你本地代理的地址),然后我们在此执行 doctor,得到以下结果,发现以下SSL HOST 问题已经解决(没有代理地址建议“换源”)

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.7.0, on macOS 12.6.3 21G419 darwin-x64, locale
    zh-Hans-CN)
    ! Warning: `dart` on your path resolves to
      /usr/local/Cellar/dart/2.2.0/libexec/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/em_er/development/flutter. Consider
      adding /Users/em_er/development/flutter/bin to the front of your path.
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.5)
[✓] VS Code (version 1.76.1)
[!] Proxy Configuration
    ! NO_PROXY is not set
[✓] Connected device (3 available)
[✓] HTTP Host Availability

我们看到目前只剩下 Unable to find bundled Java version、Android license status unknown、Warning: `dart` on your path resolves 问题了;

我们来看 Unable to find bundled Java version 问题;

https://github.com/flutter/flutter/issues/118502
这个是关于这个问题的讨论(注意,这个问题在Android Studio 或者 Idea更新后,还是会出现), Flutter 3.7 之后出现的问题,最新版本已经解决了这个问题。

执行 flutter upgrade 对 Flutter 进行升级,升级后重新执行 flutter doctor

 

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.7.10, on macOS 12.6.3 21G419 darwin-x64, locale
    zh-Hans-CN)
    ! Warning: `dart` on your path resolves to
      /usr/local/Cellar/dart/2.2.0/libexec/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/em_er/development/flutter. Consider
      adding /Users/em_er/development/flutter/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] Android Studio (version 2022.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.5)
[✓] VS Code (version 1.76.1)
[!] Proxy Configuration
    ! NO_PROXY is not set
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 2 categories.

dart 环境变量问题,这个是 flutter 更新到最新几个版本出现的问题,此问题可以忽略:

// 使用命令获取当前系统中的所有 dart 路径
 which -a dart  

// 结果
/usr/local/bin/dart
/usr/local/bin/dart
/Users/xxx/development/flutter/bin/dart

 

  • 是否安装了多个dart?flutter默认自带dart,如果安装了请卸载
  • 环境变量先后顺序,把flutter的环境变量放到 /usr/local/bin 的前面
  • 也可以将路径修改为:export PATH="/path/to/flutter/bin:$PATH" 这种形式

具体问题讨论:https://github.com/flutter/flutter/issues/115651#issuecomment-1409619007

 

NO_PROXY is not set 的问题是,开启的代理的原因,关闭代理消失;可以忽略。

 

 

帮助教程

提供最新的帮助教程,方便使用。

文章评论