Search code examples
ruby-on-railsrubyrubygemsbundlerrack

Bundle won't recognize installed gems


I'm trying to run "bundle install --without production" with this as the result:

bundle install --without production
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies..............
Using rake 11.2.2
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Installing rack 2.0.1

Gem::InstallError: rack requires Ruby version >= 2.2.2.
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.0.0
Using bundler 1.12.5
Using byebug 9.0.5
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using method_source 0.8.2
Using thor 0.19.1
Using debug_inspector 0.0.2
Using ffi 1.9.14
Using multi_json 1.12.1
Using rb-fsevent 0.9.7
Using puma 3.4.0
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Using sqlite3 1.3.11
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.6.8
An error occurred while installing rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.

So multiple times, I have run

gem install rack -v 2.0.1

with the result:

Successfully installed rack-2.0.1
Parsing documentation for rack-2.0.1
Done installing documentation for rack after 3 seconds
1 gem installed

I call "rbenv rehash" and retry bundle install and the exact same error message shows up. When I call "ruby -v", it shows I have ruby version 2.3.1. How do I get the bundler to recognize that I have updated Ruby? Is this a problem with Bundler? Am I saving the gems to the wrong place? I have searched similar questions for hours and none of the solutions worked.


Solution

  • The error says you need Ruby version of 2.2.2 or greater. Can you check which version you have? ruby -v in the command line should work

    EDIT: Looks like you just had to restart your terminal window...