the main reason for this problem is your machine and gemfile using a different ruby version
so there is multiple problems and solutions for this issue you can try the below solutions one by one
1- make sure your machine install and use the same version of your gemfile if your machine not using the same one try to install this version using rvm
$ rvm install ruby_version_you_want
make sure the version installed success by using this command
$ rvm list
and if the new version doesn't set as a default you can set it using this command
$ rvm --default use ruby_version_you_want
you can check the current ruby version
$ rvm current
$ ruby -v
2- if you have the same issue check your bundler
$ gem install bundler
or
$ gem update bundler
3- in some cases spring still using the old version so you need to stop it
$ ./bin/spring stop
4- another case you can type
$ gem pristine --all
and try to install bundle again
5- also in some cases after install the updated ruby version you just need to restart your terminal.
6- another solution but I didn't recommend it the top-level directory of your project, create a file named .ruby-version containing your active running ruby version
7- if you still have this problem try to remove ruby and install the updated version only
$ aptitude purge ruby
.rvmrc
withrvm use 2.1.0 > /dev/null
in project dir. this swith ruby version. – Huertas.rvmrc
and put in itrvm use 2.1.0 > /dev/null
. Unfortunately I still get the same message when I run bundle install:Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0
– Syphonrvm list
to look installed ruby version. – Huertasgem install bundler
orgem update bundler
this may fix your problem. – Huertasgem update bundler
did the job. Thank you – SyphonGemfile
then ranBundle install
and worked for me. – Geologydocker-compose build
because the Dockerfile started with an older version of Ruby than used in other places. – Expediential