Incerteza
Incerteza

Reputation: 34884

Your Ruby version is 2.1.2, but your Gemfile specified 2.1.5

I have this

# Gemfile
source 'https://rubygems.org'
ruby '2.1.5'

and

#.ruby-version

2.1.5

and this

$ rvm list

rvm rubies

   ruby-1.9.3-p484 [ x86_64 ]
   ruby-2.0.0-p451 [ x86_64 ]
   ruby-2.1.0 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]
   ruby-2.1.2 [ x86_64 ]
   ruby-2.1.3 [ x86_64 ]
 * ruby-2.1.5 [ x86_64 ]

And yet I keep getting this:

$ rails s
Your Ruby version is 2.1.2, but your Gemfile specified 2.1.5

Ruby 2.1.5 is installed.

Already installed ruby-2.1.5.
To reinstall use:

    rvm reinstall ruby-2.1.5



ruby - v
ruby 2.1.2p95
$ rvm use --default 2.1.5
Using /home/alex/.rvm/gems/ruby-2.1.5

But then when I open a new tab or terminal, it reverts back to 2.1.2

ruby - v
ruby 2.1.2p95

Upvotes: 0

Views: 501

Answers (2)

Nitin
Nitin

Reputation: 7366

Your error clearly indicate that you do have another method in your code which setting default ruby-2.1.2 also.

There must be some other file than .ruby-version which setting your default ruby version. Due to which your .ruby-version file not setting default version for you nor your Gemfile.

Look into your application root directory and try find hidden file like .rvmrc or .ruby-version or similar try update or delete that file and then run rails s.

After update or delete don't forgot to reopen your application directory. (cd .. and cd /app_directory) Otherwise it won't affect changes.

Upvotes: 0

Kiloreux
Kiloreux

Reputation: 2246

If you want to use the ruby version just for now , you can choose it by

rvm use 2.1.5

And if you want to always be on that version of ruby just type

rvm --default use 2.1.5

Upvotes: 1

Related Questions