Reputation: 115
Hi guys I wonder if someone could explain the problem I'm having so that I can understand whats going on.
I am currently running ruby 2.2.2 and rails 5. I have a small test app and all is working fine. I decided to upgrade ruby to version 2.4.0, for no other reason than I think I should know how to do it and the resulting pitfalls etc, so a learning exercise.
After updating ruby to 2.4.0 which goes fine the command rails -v
returns rails not installed. If i then revert to the older ruby 2.2.2 rvm use ruby-2.2.2
run rails -v
then rails 5.0.1 is returned. Whats happening here?
Thanks
Upvotes: 2
Views: 1571
Reputation: 832
Extending @Slava.K 's answer
I have a small test app and all is working fine. I decided to upgrade ruby to version 2.4.0, for no other reason than I think I should know how to do it and the resulting pitfalls etc, so a learning exercise.
rails
and bundler
.gem install rails -v x.x.x
and gem install
bundler
. rails -v
, this will print a version
number of the installed rails for your given Ruby.After updating ruby to 2.4.0 which goes fine the command rails -v returns rails not installed. If i then revert to the older ruby 2.2.2 rvm use ruby-2.2.2 run rails -v then rails 5.0.1 is returned. Whats happening here?
gem env home
=> ../versions/jruby-1.7.12/lib/ruby/gems/shared
rvm
Upvotes: 1
Reputation: 3080
RVM gives you a separate gem directory for each and every Ruby version and gemset. This means that gems must be explicitly installed for each revision and gemset. Usually the migration process is as follows:
rvm use ruby-2.4.0
# or `rvm --default use ruby-2.4.0` if you want to use 2.4.0 from now on
gem install rails -v 5.0.1 # an example, use any version you like
gem install bundler
bundle install # to install all other project gems
See the RVM gemsets documentation page.
Upvotes: 2