Getting bug with rvm ruby versions

I'm getting the following bug when I run rails c:

Your Ruby version is 2.1.2, but your Gemfile specified 2.2.2

When I run $rvm list rubies, I get the following:

rvm rubies
=* ruby-2.2.2 [ x86_64 ]

I am confused. I tried to change the Ruby version in the Gemfile to 2.1.2 and install ruby-2.1.2. However I still get:

Your Ruby version is 2.2.2, but your Gemfile specified 2.1.2

Any suggestions?

Upvotes: 3

Views: 319

Answers (3)

Obromios
Obromios

Reputation: 16393

Neither answer worked for me, and I already had 2.2.2 installed and specified in .ruby-version. What worked for me was

rvm use 2.1.2
rvm use 2.2.2

and then everything works fine. I suspect that rvm was somehow confused.

Declaration: In reality, I had this problem with swapping between 2.5.9 and 2.7.3.

Upvotes: 0

Adnan Devops
Adnan Devops

Reputation: 503

Please install ruby-2.2.2 on your system then do either one of these:

1. rvm use ruby-2.2.2
2. create a .ruby-version file inside your application root folder with the following content:
   2.2.2

Upvotes: 2

dax
dax

Reputation: 11007

Try this:

$ rm Gemfile.lock
$ bundle

Upvotes: 1

Related Questions