在总共 85 个 gem(s) (Gem::MissingSpecError) 中找不到 'ffi' (>= 1.3.0) 在 pod 安装上反应本机 IOS

Could not find 'ffi' (>= 1.3.0) among 85 total gem(s) (Gem::MissingSpecError) React native IOS on pod install

您好,我正在尝试 运行 我的 React 本机应用程序在 mac mini 上。我可以 运行 另一个应用程序也可以使用这个应用程序,但是当我在终端中写入 pod install 时,它会出现此错误。

1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1449:in `block in activate_dependencies'

    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'ffi' (>= 1.3.0) among 85 total gem(s) (Gem::MissingSpecError)
    Checked in 

'GEM_PATH=/Users/xx/.gem/ruby/2.6.0:/Library/Ruby/Gems/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0', execute `gem env` for more information

我尝试了很多类似的代码

sudo gem pristine --all,  gem pristine --all

sudo gem install -n /usr/local/bin cocoapods -v 1.8.4

delete and ini pod init/ which gave error
brew reinstall cocoapods
\curl -sSL https://get.rvm.io | bash -s stable --ruby

你可以试试这个命令

sudo gem uninstall -aIx
rm -rf ~/.gem
sudo gem install cocoapods

sudo chown -R $USER ~/Library/Caches/CocoaPods

对我来说,安装新版本 ruby 解决了这个问题。

curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm list known
rvm install 2.7.2
sudo gem install cocoapods

同样的问题。只需更新 gem 包管理器就可以了

gem update

终端会显示正在安装'ffi'

Successfully installed ffi-1.15.5