最近,在运行Flutter项目的时候,报了如下一个错误:
代码语言:javascript复制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
意思是,安装了CocoaPods,但它不工作。如果安装CocoaPods的Ruby版本与用于调用它的版本不同,就会发生这种情况。对于上面这个问题,我们只需要下面几步就可以解决: 1,首先查看CocoaPods的版本。
代码语言:javascript复制pod --version
如果没有安装,使用下面的命令安装:
代码语言:javascript复制sudo gem install cocoapods
如果是Flutter,还可以能会报如下错误:If with sudo its failing,First download and install brew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
,此时需要运行如下命令:
brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install