Flutter报错Got socket error trying to find package flutter_custom_clippers at https://pub.dartlang.org
程序员文章站
2024-03-19 22:36:34
...
问题描述:
Got socket error trying to find package coverage at http://pub.dartlang.org
Error: Unable to pub upgrade flutter tool. Retrying in five seconds...
大致意思是连接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.
解释一下:大致意思是,如果在中国安装flutter,配置国内镜像是很好的解决办法。 到此,解决方法找到。
配置本地环境方法
对于 Linux 和 MacOS 来说,添加如下两条环境变量即可:
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
对于Window
系统变量创建两个
name: PUB_HOSTED_URL;
value: https://pub.flutter-io.cn
name: FLUTTER_STORAGE_BASE_URL;
value: https://storage.flutter-io.cn
上一篇: 日志模块的简单使用
下一篇: requests模块的简单使用