I have a Rails app. My collaborator updated the app's Ruby version and added Gems. I had to update my local version of Ruby to 2.3.1.
Now it seems that rails s looks for gems in a different location than where bundle install puts them. What do I have to do to get both to put and look for gems in the same place?
Concretely, when I try to start the Rails server with
rails s
I get the message
/Users/Falk/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'railties' (>= 0) among 5 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Falk/.gem/ruby/2.3.0:/Users/Falk/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0', execute `gem env` for more information
from /Users/Falk/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /Users/Falk/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/rails:22:in `<main>'
This happens even though I have already run
bundle install
and all the required gems are included in the gem file. I was able to make progress by manually uninstalling and reinstalling individual gems through
gem uninstall <gem_name>
gem install <gem_name>
but it kept on complaining about one missing gem after another. Then I uninstalled all gems using
for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
After that, bundle install still acts as if all gems were already installed. But rails s still does not work and complains about missing gems. What should I do now?