如何修复在Flutter中连接到https://cocoapods.org的主机失败?

huangapple go评论81阅读模式
英文:

How to fix Failed to connect to host for https://cocoapods.org in flutter?

问题

当我运行 'flutter doctor -v' 时,Flutter(Channel stable, 3.7.5,在 macOS 13.2.1 22D68 darwin-arm64 上)出现了以下检查问题:

[!] HTTP 主机可用性

    ✗ HTTP 主机 "https://cocoapods.org/" 无法访问。原因:在 10 秒内未能连接到主机。

我尝试重新安装 CocoaPods,但没有成功。

英文:

When I run 'flutter doctor -v' Flutter (Channel stable, 3.7.5, on macOS 13.2.1 22D68 darwin-arm64) , I get this check:

[!] HTTP Host Availability

    ✗ HTTP host "https://cocoapods.org/" is not reachable. Reason: Failed to connect to host in 10 seconds.`

I tried to re-install cocoapods but it didn't work.

答案1

得分: 1

尝试升级并更改通道,这对我有所帮助。

flutter upgrade
flutter channel master
flutter doctor -v
英文:

Try upgrade and changing the channel, it helped me.

flutter upgrade
flutter channel master
flutter doctor -v

答案2

得分: 1

有时可能会发生。您可以像上一个答案一样升级您的Flutter(或者不升级)。尽管如此,您可以:

```sh
flutter clean
flutter pub get

这在大多数情况下可以解决您的问题。


<details>
<summary>英文:</summary>

Sometimes it might happen. What you can do is, like the previous answer, do an upgrade of your flutter (or maybe not). Nonetheless, you can:

```sh
flutter clean
flutter pub get

This can solve your problem in most of the cases.

答案3

得分: 0

在更新 Microsoft Defender 后,我遇到了相同的问题。在禁用 Defender 后,问题消失了。 通过 Defender 应用程序关闭 实时保护基于云的保护。再次使用 flutter doctor 命令检查。

问题解决后,我重新激活了防病毒软件,问题没有再次出现。

此外,有时由于网络连接不佳会出现此类错误。

英文:

I had the same problem after updating Microsoft defender. After Disabling Defender, the problem went away. Real-time protection and cloud-based protection turn it off via the Defender app. Check again with flutter doctor command.

After it was fixed, I activate the antivirus and the problem did not appear again.

In addition, sometimes such an error occurs due to poor internet connection.

huangapple
  • 本文由 发表于 2023年2月27日 04:13:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75574751.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定