The wrong Ruby version when working with cocoapod - ruby

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

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".

Related

How to resolve Cannot load such file openssl error?

I tried running gem install bundler and got this error, have tried all the link on SO already, please help.
Ignoring eventmachine-1.2.7 because its extensions are not built. Try: gem pristine eventmachine --version 1.2.7
Ignoring nokogiri-1.10.10 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.10
Ignoring oj-3.7.12 because its extensions are not built. Try: gem pristine oj --version 3.7.12
Ignoring yaji-0.3.6 because its extensions are not built. Try: gem pristine yaji --version 0.3.6
Ignoring yaji-0.3.5 because its extensions are not built. Try: gem pristine yaji --version 0.3.5
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Uninstall ruby and opensssl and then run this:
rvm reinstall 2.2.9 --with-openssl-dir=$HOME/.rvm/usr

Downgrading Ruby Version for my Rails App

I'm trying to deploy my app 'project'. It's written in Ruby using Rails and it says I need to downgrade Ruby from 2.5.1 to 2.4.0. I've tried a mix of tinkering with my Gemfile and some RVM commands in my Terminal but nothing seems to work. SOS pls send help!
I changed the ruby v in the Gemfile to "2.4.0" and when I enter the directory it notifies me that:
Using: /Users/me/.rvm/gems/ruby-2.4.0#rails3
Then I tried to run "rails s" and receive:
Ignoring nokogiri-1.8.3 because its extensions are not built. Try: gem pristine nokogiri --version 1.8.3
/Users/me/.rvm/gems/ruby-2.4.0#rails3/gems/railties-5.2.0/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Ignoring bcrypt-3.1.12 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.12
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
Ignoring bootsnap-1.3.0 because its extensions are not built. Try: gem pristine bootsnap --version 1.3.0
Ignoring byebug-10.0.2 because its extensions are not built. Try: gem pristine byebug --version 10.0.2
Ignoring ffi-1.9.25 because its extensions are not built. Try: gem pristine ffi --version 1.9.25
Ignoring msgpack-1.2.4 because its extensions are not built. Try: gem pristine msgpack --version 1.2.4
Ignoring nio4r-2.3.1 because its extensions are not built. Try: gem pristine nio4r --version 2.3.1
Ignoring nokogiri-1.8.3 because its extensions are not built. Try: gem pristine nokogiri --version 1.8.3
Ignoring puma-3.11.4 because its extensions are not built. Try: gem pristine puma --version 3.11.4
Ignoring sqlite3-1.3.13 because its extensions are not built. Try: gem pristine sqlite3 --version 1.3.13
Ignoring websocket-driver-0.7.0 because its extensions are not built. Try: gem pristine websocket-driver --version 0.7.0
/Users/brianna/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
from /Users/me/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/me/proj/bin/spring:8:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
As per the description and logs shared it seems like you have changed the ruby version but haven't build the gemset over the modified version.
Below mentioned log trail implies that it could not find the bundler for the specific ruby version(2.4.0)
/Users/brianna/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
Try following steps:
1) Install bundler corresponding to ruby 2.4.0 using
gem install bundler
2) Now, either delete the Gemfile.lock and run the following command:
bundle install
Or try running
bundle update
3) Note that if there are any gems specified with a specific version that are compatible with ruby >=2.5, then you may have to either remove the version number of specify the version which is compatible with ruby 2.4.0
Hope it helps!!
You are trying to instal Nokogiri gem which required that you first install some dependent libraries and build on your local machine some time. In order to do so you may follow following guide to install nokogiri.
Nokogiri Installation
Sometime it become typical to install nokogiri on some Enviornment

Updating Vagrant and Gems Extentions Not Built In

Should I be concerned with the gems for running vagrant?
➜ ~ vagrant version
Ignoring nokogiri-1.6.3.1 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.3.1
Ignoring unf_ext-0.0.7.1 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.1
Installed Version: 1.9.0
Latest Version: 1.8.7
You're running an up-to-date version of Vagrant!
➜ ~ gem pristine nokogiri --version 1.6.3.1
ERROR: While executing gem ... (Gem::Exception)
Failed to find gems ["nokogiri"] = 1.6.3.1
➜ ~ gem pristine nokogiri --version 1.6.3.1
ERROR: While executing gem ... (Gem::Exception)
Failed to find gems ["nokogiri"] = 1.6.3.1
I experienced this after upgrading to MacOS 10.2.2 and Vagrant 1.9.1. I'm not sure which caused this issue.
Based on info at https://groups.google.com/forum/#!topic/vagrant-up/z6GX-3Qn3ZM I used the uninstaller script and then re-installed Vagrant and I stopped seeing these 2 lines.

Error ruby version When i'm running bundle install in Jekyll

I have reinstalled and updated my Ubuntu to 16.04, so now i have installed RVM for use Jekyll, but i have a problem when run bundle install of gemfile.
$ bundle install
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
Your Ruby version is 2.3.1, but your Gemfile specified 2.2.0
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm gemset list
gemsets for ruby-2.2.0 (found in /home/kedinn/.rvm/gems/ruby-2.2.0)
No running because this 2.3.1, but your Gemfile specified 2.2.0 why? if i have using ruby-2.2.0
It looks like you have both RVM and rbenv installed, and they are probably in conflict. Since they do more or less the same things, it should be safe to get rid of one of them. It means the rbenv installation of ruby is broken.
sudo rm -rf ~/.rbenv
Try installing Ruby like this

gem check errors (registered but missing gems) after installing ruby 2.0.0-p0 with rbenv install

Everything works fine with my installation of ruby 1.9.3.
$ rbenv global 1.9.3-p385
$ gem list
*** LOCAL GEMS ***
bigdecimal (1.1.0)
io-console (0.3)
json (1.5.4)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)
$ gem check
$
However after I installed ruby 2.0.0 with rbenv install, some strange error messages showed up in gem check.
$ rbenv install 2.0.0-p0
Downloading openssl-1.0.1e.tar.gz...
-> https://www.openssl.org/source/openssl-1.0.1e.tar.gz
Installing openssl-1.0.1e...
Installed openssl-1.0.1e to /Users/gogao/.rbenv/versions/2.0.0-p0
Downloading ruby-2.0.0-p0.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
Installing ruby-2.0.0-p0...
Installed ruby-2.0.0-p0 to /Users/gogao/.rbenv/versions/2.0.0-p0
$ rbenv global 2.0.0-p0
$ rbenv rehash
$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.0)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
test-unit (2.0.0.0)
$ gem check
Checking gems...
bigdecimal-1.2.0.gem has 1 problems
bigdecimal-1.2.0:
Gem registered but doesn't exist at /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bigdecimal-1.2.0
io-console-0.4.2.gem has 1 problems
io-console-0.4.2:
Gem registered but doesn't exist at /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/io-console-0.4.2
json-1.7.7.gem has 1 problems
json-1.7.7:
Gem registered but doesn't exist at /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7
minitest-4.3.2.gem has 1 problems
minitest-4.3.2:
Gem registered but doesn't exist at /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/minitest-4.3.2
psych-2.0.0.gem has 1 problems
psych-2.0.0:
Gem registered but doesn't exist at /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/psych-2.0.0
rake-0.9.6.gem has 2 problems
/Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/cache/rake-0.9.6.gem:
missing gem file /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/cache/rake-0.9.6.gem
/Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/specifications/rake-0.9.6.gemspec:
Spec file missing for installed gem
rdoc-4.0.0.gem has 2 problems
/Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/cache/rdoc-4.0.0.gem:
missing gem file /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/cache/rdoc-4.0.0.gem
/Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/specifications/rdoc-4.0.0.gemspec:
Spec file missing for installed gem
test-unit-2.0.0.0.gem has 2 problems
/Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/cache/test-unit-2.0.0.0.gem:
missing gem file /Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/cache/test-unit-2.0.0.0.gem
/Users/gogao/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/specifications/test-unit-2.0.0.0.gemspec:
Spec file missing for installed gem
$
Is it a known bug? or am i doing something wrong?
For Ruby 2.0.0-p0, I also get similar warnings from gem check. However, I don't have issues at runtime with any of these gems. I suspect this might be a bug with Rubygems check command in 2.0.0.
I have similar errors. Passing options to compiler fix installation.
Before install readline and openssl with Homebrew.
RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)
--with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.0.0-p0
More info from Original Post

Resources