Downgrading Ruby Version for my Rails App - ruby

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

Related

fastlane -v command shows Ignoring executable-hooks-1.6.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1

I am using ruby version 3.0.0 and fastlane version 2.197.
How can I fix this?
After running the gem pristine digest-crc --version 0.6.4, it not resolved
fastlane -v
Ignoring digest-crc-0.6.4 because its extensions are not built. Try: gem pristine digest-crc --version 0.6.4
Ignoring unf_ext-0.0.8 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.8
fastlane installation at path:
/Users/name/.rvm/gems/ruby-3.0.0/gems/fastlane-2.197.0/bin/fastlane
-----------------------------
[⠋] 🚀 Ignoring executable-hooks-1.6.1 because its extensions are not built. Try: gem pristine executable-hooks --version 1.6.1
Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0
[✔] 🚀
fastlane 2.197.0
I had a similar error:
(The error started to appear after I upgraded to macOS Monterey.)
Ignoring clocale-0.0.4 because its extensions are not built. Try: gem pristine clocale --version 0.0.4
For me the problem was the rights of the Gems folder.
I solved it with:
sudo chown -R $(whoami) /Library/Ruby/Gems
followed by the suggested command:
gem pristine clocale --version 0.0.4

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

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.

The wrong Ruby version when working with cocoapod

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

How to use rbenv after using RVM

I used RVM but now I'm trying to use rbenv to test because it's used in a tutorial I liked.
I installed rbenv with Homebrew. Then I commented-out the line to load RVM in my ~/.bash_profile:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/shims:$PATH"
I installed Ruby:
$ rbenv install 2.2.1
$ rbenv global 2.2.1
but when I try to install Rails I get this error:
$ gem install rails -v 4.2.0 --no-ri --no-rdoc
Ignoring RedCloth-4.2.9 because its extensions are not built. Try: gem pristine RedCloth --version 4.2.9
Ignoring bcrypt-3.1.10 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.10
Ignoring bigdecimal-1.2.7 because its extensions are not built. Try: gem pristine bigdecimal --version 1.2.7
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-8.2.2 because its extensions are not built. Try: gem pristine byebug --version 8.2.2
Ignoring byebug-8.2.1 because its extensions are not built. Try: gem pristine byebug --version 8.2.1
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2
Ignoring eventmachine-1.0.9.1 because its extensions are not built. Try: gem pristine eventmachine --version 1.0.9.1
Ignoring eventmachine-1.0.8 because its extensions are not built. Try: gem pristine eventmachine --version 1.0.8
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring fast-stemmer-1.0.2 because its extensions are not built. Try: gem pristine fast-stemmer --version 1.0.2
Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Ignoring io-console-0.4.5 because its extensions are not built. Try: gem pristine io-console --version 0.4.5
Ignoring nokogiri-1.6.7.2 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.7.2
Ignoring nokogiri-1.6.7.1 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.7.1
Ignoring nokogiri-1.6.7 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.7
Ignoring posix-spawn-0.3.11 because its extensions are not built. Try: gem pristine posix-spawn --version 0.3.11
Ignoring psych-2.0.17 because its extensions are not built. Try: gem pristine psych --version 2.0.17
Ignoring psych-2.0.16 because its extensions are not built. Try: gem pristine psych --version 2.0.16
Ignoring rdiscount-2.1.8 because its extensions are not built. Try: gem pristine rdiscount --version 2.1.8
Ignoring redcarpet-3.3.4 because its extensions are not built. Try: gem pristine redcarpet --version 3.3.4
Ignoring redcarpet-3.3.3 because its extensions are not built. Try: gem pristine redcarpet --version 3.3.3
Ignoring sqlite3-1.3.11 because its extensions are not built. Try: gem pristine sqlite3 --version 1.3.11
Ignoring therubyracer-0.12.2 because its extensions are not built. Try: gem pristine therubyracer --version 0.12.2
Ignoring thin-1.6.4 because its extensions are not built. Try: gem pristine thin --version 1.6.4
Ignoring thin-1.5.1 because its extensions are not built. Try: gem pristine thin --version 1.5.1
Ignoring yajl-ruby-1.2.1 because its extensions are not built. Try: gem pristine yajl-ruby --version 1.2.1
Ignoring RedCloth-4.2.9 because its extensions are not built. Try: gem pristine RedCloth --version 4.2.9
Ignoring bcrypt-3.1.10 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.10
Ignoring bigdecimal-1.2.7 because its extensions are not built. Try: gem pristine bigdecimal --version 1.2.7
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-8.2.2 because its extensions are not built. Try: gem pristine byebug --version 8.2.2
Ignoring byebug-8.2.1 because its extensions are not built. Try: gem pristine byebug --version 8.2.1
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2
Ignoring eventmachine-1.0.9.1 because its extensions are not built. Try: gem pristine eventmachine --version 1.0.9.1
Ignoring eventmachine-1.0.8 because its extensions are not built. Try: gem pristine eventmachine --version 1.0.8
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring fast-stemmer-1.0.2 because its extensions are not built. Try: gem pristine fast-stemmer --version 1.0.2
Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Ignoring io-console-0.4.5 because its extensions are not built. Try: gem pristine io-console --version 0.4.5
Ignoring nokogiri-1.6.7.2 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.7.2
Ignoring nokogiri-1.6.7.1 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.7.1
Ignoring nokogiri-1.6.7 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.7
Ignoring posix-spawn-0.3.11 because its extensions are not built. Try: gem pristine posix-spawn --version 0.3.11
Ignoring psych-2.0.17 because its extensions are not built. Try: gem pristine psych --version 2.0.17
Ignoring psych-2.0.16 because its extensions are not built. Try: gem pristine psych --version 2.0.16
Ignoring rdiscount-2.1.8 because its extensions are not built. Try: gem pristine rdiscount --version 2.1.8
Ignoring redcarpet-3.3.4 because its extensions are not built. Try: gem pristine redcarpet --version 3.3.4
Ignoring redcarpet-3.3.3 because its extensions are not built. Try: gem pristine redcarpet --version 3.3.3
Ignoring sqlite3-1.3.11 because its extensions are not built. Try: gem pristine sqlite3 --version 1.3.11
Ignoring therubyracer-0.12.2 because its extensions are not built. Try: gem pristine therubyracer --version 0.12.2
Ignoring thin-1.6.4 because its extensions are not built. Try: gem pristine thin --version 1.6.4
Ignoring thin-1.5.1 because its extensions are not built. Try: gem pristine thin --version 1.5.1
Ignoring yajl-ruby-1.2.1 because its extensions are not built. Try: gem pristine yajl-ruby --version 1.2.1
Error loading RubyGems plugin "/Users/romenigld/.rvm/gems/ruby-2.2.3#global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": cannot load such file -- executable-hooks/wrapper (LoadError)
Error loading RubyGems plugin "/Users/romenigld/.rvm/gems/ruby-2.2.3#global/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": cannot load such file -- gem-wrappers (LoadError)
Ignoring psych-2.0.17 because its extensions are not built. Try: gem pristine psych --version 2.0.17
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/romenigld/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20160303-58397-1nyc1kp.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
/Users/romenigld/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'mini_portile2' (~> 2.0.0.rc2) - did find: [mini_portile2-2.1.0] (Gem::LoadError)
Checked in 'GEM_PATH=/Users/romenigld/.gem/ruby/2.2.0:/Users/romenigld/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0:/Users/romenigld/.rvm/gems/ruby-2.2.3', execute `gem env` for more information
from /Users/romenigld/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/romenigld/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from extconf.rb:396:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/romenigld/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /Users/romenigld/.rvm/gems/ruby-2.2.3/extensions/x86_64-darwin-15/2.2.0-static/nokogiri-1.6.7.2/gem_make.out
Is it possible that RVM and rbenv are working?
"Gem files will remain installed in /Users/romenigld/.rvm"
makes it look like RVM is still trying to control your Ruby installation.
RVM is not compatible with rbenv. Per the rbenv docs:
rbenv is incompatible with RVM. Please make sure to fully uninstall RVM and remove any references to it from your shell initialization files before installing rbenv.
I'd highly recommend reading the entire rbenv documentation; It covers this, along with the use of plugins which enhance using rbenv.

Resources