当前位置:   article > 正文

Flutter报错Got socket error trying to find package flutter_custom_clippers at https://pub.dartlang.org

got socket error trying to find package

问题描述:

Got socket error trying to find package coverage at http://pub.dartlang.org

Error: Unable to pub upgrade flutter tool. Retrying in five seconds...
  • 1
  • 2
  • 3

大致意思是连接https://pub.dartlang.org配置dart包失败

访问flutter官方,仔细查看flutter的配置方法,发现如下图所示Note,相信有很多朋友配置环境的时候都没有注意该Note。

接下来查看该note内容:

If you’re installing or using Flutter in China, it may be helpful to use a trustworthy local mirror site that hosts Flutter’s dependencies. 
To instruct the Flutter tool to use an alternate storage location, 
you will need to set two environment variables, PUB_HOSTED_URL and FLUTTER_STORAGE_BASE_URL, before running the flutter command.
  • 1
  • 2
  • 3

解释一下:大致意思是,如果在中国安装flutter,配置国内镜像是很好的解决办法。 到此,解决方法找到。

配置本地环境方法

对于 Linux 和 MacOS 来说,添加如下两条环境变量即可:

 export PUB_HOSTED_URL=https://pub.flutter-io.cn 
 export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  • 1
  • 2

对于Window
在这里插入图片描述
系统变量创建两个

name: PUB_HOSTED_URL; 
value: https://pub.flutter-io.cn


name: FLUTTER_STORAGE_BASE_URL; 
value: https://storage.flutter-io.cn
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/332463
推荐阅读
相关标签
  

闽ICP备14008679号