Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting

I am getting this error while running server, how do I fix this?

enter image description here

like image 787
unknown Avatar asked Jun 20 '16 04:06

unknown


People also ask

Where is Gemfile in Ruby?

A Gemfile describes the gem dependencies required to execute associated Ruby code. Place the Gemfile in the root of the directory containing the associated code. For instance, in a Rails application, place the Gemfile in the same directory as the Rakefile .

Is Gemfile a Ruby file?

A Gemfile is a file we create which is used for describing gem dependencies for Ruby programs. A gem is a collection of Ruby code that we can extract into a “collection” which we can call later. It lets you specify which gems you want to use, and which versions of these gems to use.


2 Answers

You better install Ruby 2.2.5 for compatibility. The Ruby version in your local machine is different from the one declared in Gemfile.

If you're using rvm:

rvm install 2.2.5 rvm use 2.2.5 

else if you're using rbenv:

rbenv install 2.2.5 rbenv local 2.2.5 

else if you can not change ruby version by rbenv, read here

like image 115
Tan Nguyen Avatar answered Sep 22 '22 10:09

Tan Nguyen


If you have already installed 2.2.5 and set as current ruby version, but still showing the same error even if the Ruby version 2.3.0 is not even installed, then just install the bundler.

gem install bundler 

and then:

bundle install 
like image 26
Tarique Avatar answered Sep 22 '22 10:09

Tarique