Your Ruby version is 2.3.1, but your Gemfile speci

2019-07-09 04:19发布

问题:

I am trying to upgrade from ruby 2.3.0 to 2.4.1. To do this, I did rvm use 2.4.1@my-project --create (I am already using 2.4.1 for another project). I changed the gemfile from ruby "2.3.0" to ruby "2.4.1", and I ran bundle install. My gemfile.lock correctly changed.

However, when trying to run rails s in console, I have the error:

Your Ruby version is 2.3.1, but your Gemfile specified 2.4.1

This is not logical because when I am running which ruby I get the following answer : /.rvm/rubies/ruby-2.4.1/bin/ruby. ruby -v answers ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]. Furthermore I have never used 2.3.1 for any of my projects; when running rvm list in console, I do not see that version of ruby.

Is it possible that there is a conflict with rails? I am using rails 4.2.7.1

I tried all the answered given in the following stackoverflow issues:

  • Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0
  • Your Ruby version is 2.3.0, but your Gemfile specified 2.1.2
  • Your Ruby version is 2.3.1, but your Gemfile specified 2.1.4
  • How to fix "Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0"
  • Your Ruby version is 2.2.4, but your Gemfile specified 2.3.0?
  • Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0

So I am kind of running out of ideas. Thank you for your help!

回答1:

I faced same issue, stopping spring and clearing tmp, which includes bootsnap cache worked for me

spring stop
rake tmp:clear


标签: ruby rvm