Dave
Dave

Reputation: 19160

Why doesn't "gem install bundler" upgrade my bundler?

I’m trying to upgrade from Rails 4.2 to Rails 6. I have this in my Gemfile

fail "run 'gem install bundler' to update your bundler version" unless Bundler::VERSION >= '2.0.0'
source 'https://rubygems.org'
ruby '~> 2.6.7'

gem 'rails', '~> 6.0.0'

And when I install, I get the failure

$ bundle install

[!] There was an error parsing `Gemfile`: run 'gem install bundler' to update your bundler version. Bundler cannot continue.

 #  from /Users/davea/workspace/my-app/Gemfile:1
 #  -------------------------------------------
 >  fail "run 'gem install bundler' to update your bundler version" unless Bundler::VERSION >= '2.0.0'
 #  source 'https://rubygems.org'
 #  -------------------------------------------

So I wanted to upgrade bundler, and ran

$ gem install bundler
Successfully installed bundler-2.2.31
Parsing documentation for bundler-2.2.31
Done installing documentation for bundler after 2 seconds
1 gem installed

But this doesn’t seem to upgrade anything. I still get the same error

$ bundle install

[!] There was an error parsing `Gemfile`: run 'gem install bundler' to update your bundler version. Bundler cannot continue.

 #  from /Users/davea/workspace/my-app/Gemfile:1
 #  -------------------------------------------
 >  fail "run 'gem install bundler' to update your bundler version" unless Bundler::VERSION >= '2.0.0'
 #  source 'https://rubygems.org'
 #  -------------------------------------------

The version still seems stuck on the old version

$ bundle -v
Bundler version 1.17.3

$ bin/bundle -v
Bundler version 1.17.3

Even running

$ gem update bundler
Updating installed gems
Nothing to update

Doesn’t help. How do I upgrade my bundler?

Upvotes: 3

Views: 1473

Answers (1)

Nicholas
Nicholas

Reputation: 166

Check your Gemfile entry versions and make sure Gemfile.lock is in your version control and then:

bundle update --bundler

Upvotes: 5

Related Questions