Mac电脑Flutter环境搭建的一个坑CocoaPods installed but not working

今天给一台刚升级过12.3.1系统的Mac电脑搭建Flutter环境,遇到一个问题,卡了好几个小时,顺带记录一下。

基础搭建就不说了,这里只说遇到的问题,当我执行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.

我搜了各种答案,尝试重装flutter和cocoapods都不行,切换版本也不行。

直到我尝试使用flutter doctor指令,出现了下边这个错误提示:

Flutter failed to check for directory existence at

"/Users/mac/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-34.0.0/lib/".

Please ensure that the SDK and/or project is installed in a location that has

read/write permissions for the current user.

Try running:

  sudo chown -R $(whoami)

  /Users/mac/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-34.0.0

原来是权限问题,但不要用他推荐的指令,会提示zsh: permission denied: /Users/mac/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-34.0.0。

用下边这句指令一句就解决了,不要问我如何知道的,死马当活马医试出来的!!!

chmod u+x /Users/XXXXX/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-34.0.0

绿色部分是你电脑的用户名。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值