您当前的位置: 首页 >  flutter

xiangzhihong8

暂无认证

  • 0浏览

    0关注

    1324博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

关于Flutter报CocoaPods installed but it is not working的解决办法

xiangzhihong8 发布时间:2022-07-05 15:42:37 ,浏览量: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

再次运行就正常了。

关注
打赏
1482932726
查看更多评论
立即登录/注册

微信扫码登录

0.0934s