使用Cocoapods 发现ruby版本报错

错误例子

Traceback (most recent call last):
    4: from /Users/xmly/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `
' 3: from /Users/xmly/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval' 2: from /Users/xmly/.rvm/gems/ruby-2.7.5/bin/pod:23:in `
' 1: from /Users/xmly/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path' /Users/xmly/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)

解决方案
我是将其切换到ruby版本是2.7.0 解决这个问题

1.查看可以安装的ruby版本

rvm list known

2.安装想要的ruby版本

rvm install 

3.切换ruby设置为默认版本

rvm use ruby-2.5.1 --default

二、如果碰到错误

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

解决方法:

gem install cocoapods --user-install 1.11.3

你可能感兴趣的:(使用Cocoapods 发现ruby版本报错)