Ruby build fails with "Your Ruby version is X, but your Gemfile specified Y"


This happens when there is a difference between the version of Ruby you are using locally, and the versions specified in your Gemfile and Gemfile.lock.

You will need to update your local Ruby version to same as your Gemfile, and then run bundle update --ruby to ensure your Gemfiles and Gems are the correct versions, then commit all the changes and re-deploy to Heroku.

You can get more information in the Ruby version troubleshooting section Your Ruby version is <X>, but your Gemfile specified <Y>.