Flutter错误 Because flutter_tools depends on built_collection 4.3.2 which doesn't match any versions

报错

PS C:\Users\Administrator> flutter pub
Building flutter tool...
Running pub upgrade...
Because flutter_tools depends on built_collection 4.3.2 which doesn't match any versions, version solving failed.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)

等待 0 秒,按 CTRL+C 退出 ...
Running pub upgrade...
Because flutter_tools depends on built_collection 4.3.2 which doesn't match any versions, version solving failed.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
等待 0 秒,按 CTRL+C 退出 ...

起因

时隔许久给新电脑装Flutter环境,git clone flutter,配置环境变量
后运行flutter doctor报错

分析

Flutter 安装过程中使用了国内镜像
但是Flutter是拉的官方的git
但是pub镜像没有及时更新,导致flutter_tools 的依赖找不到最新的版本

解决方法

暂时删除PUB_HOSTED_URL
使用代理setx https_proxy 127.0.0.1:1080

或者

查看下最后Sync时间
PUB_HOSTED_URL更换其他镜像

END

Flutter错误 Because flutter_tools depends on built_collection 4.3.2 which doesn't match any versions_第1张图片

你可能感兴趣的:(Flutter)