Search code examples
rubyherokuheroku-toolbelt

Can't update Gemfile


I am upgrading my Heroku hosted ROR app from Ruby 1.9.3 to 2.3.1p112

I get this error on Heroku console

remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected a mismatch between your Ruby version installed and
remote:  !     Ruby version specified in Gemfile or Gemfile.lock. You can
remote:  !     correct this by running:
remote:  !     
remote:  !     $ bundle update --ruby
remote:  !     $ git add Gemfile.lock
remote:  !     $ git commit -m "update ruby version"
remote:  !     
remote:  !     If this does not solve the issue please see this documentation:
remote:  !     
remote:  !     https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y

So I did this and I am not sure how to fix it? Where is 2.3.1 set? If I set my Gemfile to 2.3.1 instead of 2.3.1p112 then Pushing to Heroku fails and it gives me the above error?

 MacBook-Pro-2:treesy-api me$ bundle platform --ruby
ruby 2.3.1p112
MacBook-Pro-2:treesy-api me$ bundler -v
Bundler version 1.17.1
MacBook-Pro-2:treesy-api me$ cat Gemfile.lock | grep -A 2 RUBY
RUBY VERSION
   ruby 2.3.1p112

MacBook-Pro-2:treesy-api me$ bundle update --ruby
Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1p112
MacBook-Pro-2:treesy-api me$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]s

Solution

  • Just use

    ruby '~> 2.5.1'
    

    in your Gemfile and

    2.5.1
    

    in your .ruby-version