pod命令报错 ruby版本/路径错误

运行pod --version   报错如下

Mr.Lin.@MrLindeMacBook-Pro ~ % pod --version

Traceback(most recent call last):

4: from /Users/apple/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `

'

3: from /Users/apple/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'

2: from /usr/local/bin/pod:22:in `

'

1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe':can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)

查看了下ruby的版本 发现不对 因为刚安装了3.0和3.02    ruby -v  查看ruby版本 

发现还是2.6.3  因为前面报错的路径就是2.6.3

Mr.Lin.@MrLindeMacBook-Pro ~ % ruby -v

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

 ruby list  查看已安装的所有ruby的版本

Mr.Lin.@MrLindeMacBook-Pro ~ % rvm list

   ruby-3.0.0 [ x86_64 ]

   ruby-3.0.2 [ x86_64 ]

# => - current

# =* - current && default

#  * - default

rvm use 3.0.2 -defaut  将3.0.2设置为默认版本 

Mr.Lin.@MrLindeMacBook-Pro ~ % rvm use 3.0.2 --default

Using /Users/apple/.rvm/gems/ruby-3.0.2

重新查看ruby版本  是3.0.2了

Mr.Lin.@MrLindeMacBook-Pro ~ % ruby -v               

ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]

再次运行 pod --version 没毛病

Mr.Lin.@MrLindeMacBook-Pro ~ % pod --version

1.10.2

你可能感兴趣的:(pod命令报错 ruby版本/路径错误)