Bundler on Heroku won't run correct version

347 Views Asked by At

I am working in aws c9 and I am trying to send my app to heroku but it keeps telling me I am running the wrong version of bundler, so I run gem install bundler locally and I get 2.0.1, but on Heroku it keeps running 1.17.1 and I can't change this version.

1

There are 1 best solutions below

7
On

Heroku pin the bundler version for reasons of their own:

The Bundler version on Heroku is carefully curated. A balance needs to be struck between supporting new Bundler features and stability. The work we put into curating the Bundler version ensures maximum stability, and avoids deprecation and notification cycles on Bundler as it changes, or as bugs are fixed or security issues are patched by Heroku.

https://devcenter.heroku.com/articles/bundler-version

They're still on 1.17.1 at time of writing, but that shouldn't generally be a problem.

EDIT

This might be a problem because your local version of bundler is later than that. This is especially the case if you're running bundler 2+ locally, because that creates a Gemfile.lock which won't allow older versions to install from it.

If that's the case then you need to downgrade your local version and rebundle:

local> gem uninstall bundler
local> gem install bundler -v 1.17.1 (or whatever version)
local> rm Gemfile.lock
local> bundle install