Flutter For Mac M1 flutter doctor 遇见的问题
刚刚接触flutter做一个记录,也分享给需要帮助的小伙伴
从flutter 官网上下载的sdk在我的电脑上不行,有以下错误:
- flutter doctor 时候没有什么反应 直接跳过了,需要使用 sudo flutter doctor
sudo flutter doctor
但是会报错:
CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with
is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
To re-install see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
开始以为是Ruby 和 CocoaPods 的版本冲突,一直在捣鼓这个问题,搞得我发疯。一般最新的就没有问题了
解决:
从GitHub上下载SDK:
git clone https://github.com/flutter/flutter.git -b stable
使用这个SDK就可以直接使用:
flutter doctor
但是我还遇到一个问题:
Creation failed, path = '/Users/xxx/.pub-cache/hosted-hashes/pub.flutter-io.cn'
(OS Error: Permission denied, errno = 13)
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...
(9 tries left)
Resolving dependencies... ^CError: Unable to 'pub upgrade' flutter tool.
Retrying in five seconds... (8 tries left)
根据他的提示,删除这个缓存文件: /Users/xxx/.pub-cache,重新 flutter doctor,问题解决