Flutter新建项目时遇到Pub get failed (server unavailable)问题的解决方案

今天,初学flutter的我在win10上新建一个flutter项目的时候,报了一个这样的错误:

D:\>flutter create demo
Recreating project D:\demo...
Because demo depends on cupertino_icons any which doesn't exist (could not find package cupertino_icons at https://storage.flutter-io.cn), version solving failed.
pub get failed (server unavailable) -- attempting retry 1 in 1 second...
Because demo depends on cupertino_icons any which doesn't exist (could not find package cupertino_icons at https://storage.flutter-io.cn), version solving failed.
pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...
Because demo depends on cupertino_icons any which doesn't exist (could not find package cupertino_icons at https://storage.flutter-io.cn), version solving failed.
pub get failed (server unavailable) -- attempting retry 3 in 4 seconds...
Running "flutter pub get" in demo...

于是,我愤怒地在Github flutter上面开了一个issue,地址(顺便关注一下啊):
https://github.com/flutter/flutter/issues/52223
大神们很简短地给了2行代码,问题轻松解决!

setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"

这是一段powershell代码,大伙们可以在vscode上的终端上运行,回车一按,问题轻松解决!

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值