1

In my .ruby-version and Gemfile the ruby 2.5.0 is specified. When I run "ruby -v", I get "2.5.0". However, when deploying to Heroku, I get this error:

    Your Ruby version is 2.4.2, but your Gemfile specified 2.5.0

Why? How to fix it?

Rato
  • 11
  • 1
  • 3
  • 1
    Possible duplicate of [How to fix "Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0"](https://stackoverflow.com/questions/19342044/how-to-fix-your-ruby-version-is-1-9-3-but-your-gemfile-specified-2-0-0) – Hamdi Bayhan Feb 08 '18 at 06:31
  • other duplicate of https://stackoverflow.com/questions/23039528/your-ruby-version-is-2-0-0-but-your-gemfile-specified-2-1-0?rq=1 – Hamdi Bayhan Feb 08 '18 at 06:33

3 Answers3

3

According to https://devcenter.heroku.com/articles/ruby-versions#troubleshooting following causes this issue

  1. Your bundler version might be old
  2. You might have version mismatch between Gemfile and Gemfile.lock
nerding_it
  • 704
  • 7
  • 17
0

If ruby -v is outputting 2.5.0, you may need to update Gemfile.lock. The best way to do that is using bundler.

Check the Gemfile.lock file in your project's root to see which version of Ruby it references. It likely will say ruby 2.4.2.

Running either bundle update or bundle install should get your Gemfile and Gemfile.lock matched up again.

tecz
  • 31
  • 6
0

At first update The Ruby version installed in your PC/ Laptop (If Any)!!.

Delete the ruby " [version number] " which is written in gemfile,

just Tweak the Version to The Upgraded version installed in your PC .. <3

sounish nath
  • 567
  • 4
  • 3