0

Whenever I run a rails command (e.g. rails s), I get a message saying "Your Ruby version is X, but you Gemfile specified is Y". I've searched and searched and all of the answers either say to update/install bundler (which I have), or obviously that it is using the wrong version (which I am not as you can see from the output). I'm not even sure where it is getting 2.1.5 from since I am using rvm. When I do rails new app_name, I am getting an error that says No such file or directory -- /usr/bin/bundle (LoadError)...so that does correspond to something with bundler, but I can't quite figure it out. I am using Ubuntu 15.10.

12:50 $ rails
Your Ruby version is 2.1.5, but your Gemfile specified 2.3.0
12:50 $ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
12:50 $ rvm ls

rvm rubies

   ruby-2.2.1 [ x86_64 ]
=* ruby-2.3.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default
Community
  • 1
  • 1
Trinculo
  • 1,950
  • 1
  • 17
  • 22

1 Answers1

1

do

rvm --default use 2.3.0

to set your default version of ruby. then install rails in that version of ruby.

georgebrock
  • 28,393
  • 13
  • 77
  • 72
Kirka121
  • 505
  • 4
  • 13
  • I get an error when I run that statement "RVM is not a function, selecting rubies with 'rvm use ...' will not work." When I do `rvm ls`, it lists my current AND default as 2.3.0 though. – Trinculo Feb 24 '16 at 19:10
  • Hmmm. After closing my terminal and re-opening and doing `ruby -v`, it now says 2.1.5 (not what it said earlier)...even though `rvm ls` still shows 2.3.0. It is like it is not using rvm at all. – Trinculo Feb 24 '16 at 19:12
  • Never mind...got it. I added this to the bottom of my .bashrc `[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*` and then installed rails from there. – Trinculo Feb 24 '16 at 19:21
  • 1
    yeah RVM needs to be in path for this to work, and after you have set the default it will automatically switch to that version of ruby. now when you install the rails version you like inside that ruby, you will always have access to it :) – Kirka121 Feb 24 '16 at 19:59