Search code examples
ruby-on-railsbundlerrbenvgemfile

Bundle update error when switching from 2.3 to 2.4


I am trying to move from Ruby 2.3 to 2.4.2 and monogID 5.0 to 5.2

I am getting a Bundle Update error.

I am using rbenv and installed and set locally 2.4.2.

I then ran had to run gem install bundler -> it installed 2.0.1

I then ran bundle update and I get this error.

      Bundler could not find compatible versions for gem "bundler":
    In Gemfile:
      iron_worker_ng was resolved to 1.6.10, which depends on
        bundler

      rails (~> 4.2) was resolved to 4.2.11, which depends on
        bundler (< 2.0, >= 1.3.0)

    Current Bundler version:
      bundler (2.0.1)
  This Gemfile requires a different version of Bundler.
  Perhaps you need to update Bundler by running `gem install bundler`?

  Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails
  (~> 4.2)', in any of the sources.

  Bundler could not find compatible versions for gem "mongoid":
    In Gemfile:
      mongoid (~> 5.2)

      mongoid-encrypted-fields was resolved to 1.2.2, which depends on
        mongoid

I am not sure how to fix this?


Solution

  • The first thing you need to do is install a compatible version of bundler

    gem install bundler -v '~> 1.17'
    

    rails (~> 4.2) was resolved to 4.2.11, which depends on
    bundler (< 2.0, >= 1.3.0)

    Seems like you are using rails 4.2 which requires the old version of bundler

    Then run

    bundle install
    

    and you will need to resolve some other dependencies as well