mac上运行命令:react-native init myFirstProject --verbose
提示需要安装CocoaPods,
运行:sudo gem install cocoapods
报错:
ERROR: Error installing cocoapods:
The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems was 6.1.7.3. Try installing it with `gem install activesupport -v 6.1.7.3` and then running the current command again
activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
我选择了升级ruby到2.7,于是根据chatgpt的提示,我又参考了:https://stackoverflow.com/questions/60182199/upgrading-global-ruby-version-on-macos 和 https://rvm.io/rvm/install , 安装了rvm,然后安装2.7 ruby
gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --ruby
# 安装 cocoapods
sudo gem install cocoapods