关于Flutter报CocoaPods installed but it is not working的解决办法
  n8qElEWxztXt 2023年11月02日 38 0


最近在搭建Flutter环境的时候,使用​​flutter doctor -v​​出现以下警告:

[!] Xcode - develop for iOS and macOS (Xcode 13.4.1)
✗ 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的版本不对应产生的问题。Ruby Version Manager(Ruby版本管理器)是用于类UNIX操作系统的软件平台,用于管理同一设备上Ruby的多个安装。如果还没有安装,可以使用下面的命令安装:

$ curl -L https://get.rvm.io | bash -s stable

然后,再使用source命令使rvm生效。

$ source ~/.bash_profile
$ source ~/.bashrc

接下来,就是使用nvm安装指定的ruby版本。安装之前可以使用下面的命令查看可用的ruby版本。

rvm list known
//安装指定版本
rvm install "ruby-3.1.2-default"

由于网络的原因,安装会比较慢,安装完成之后,可以使用​​ruby -v​​来查看是否正确安装。最后,在使用下面的命令安装cocoapods。

sudo gem install cocoapods

再次运行就正常了。


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  b1UHV4WKBb2S   2023年11月13日   33   0   0 裁剪ideflutter
  b1UHV4WKBb2S   2023年11月13日   26   0   0 flutterDart
n8qElEWxztXt