问题
Our project is written in Objective-C, and use an old version of cocoapod (0.38.0).
All my colleagues use the old version of Ruby (2.0.0). I have the latest version of Ruby (2.3.1), so I need to install more the old Ruby version (2.0.0) as my colleagues have.
rvm install 2.0.0 rvm use 2.0.0
I cocoapod install
pod _0.38.0_ install
and get an error like this:
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2 Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7 /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'cocoapods' (= 0.38.0) among 11 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/Users/chipbk10/.rvm/gems/ruby-2.0.0-p648:/Users/chipbk10/.rvm/gems/ruby-2.0.0-p648@global', execute `gem env` for more information from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec' from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem' from /usr/local/bin/pod:22:in `
I tried as suggested, but it doesn't help
gem pristine executable-hooks --version 1.3.2 gem pristine gem-wrappers --version 1.2.7
Another strange thing is in the error, there are different versions of Ruby appear: 2.0.0, 2.3.1, 2.3.0
This is all ruby versions I have
rvm list rubies =* ruby-2.0.0-p648 [ x86_64 ] ruby-2.3.1 [ x86_64 ]
my cocoapod version is
pod --version 1.0.1
回答1:
Probably you have ruby 2.3.0 installed with system and versions 2.0.0 and 2.3.1 installed in rvm. Ruby 2.3.0 is first in PATH variables list than rvm one, so system sees it. If it won't help please provide results of "which ruby" and "echo $PATH".
来源:https://stackoverflow.com/questions/39227718/the-wrong-ruby-version-when-working-with-cocoapod