Home > Software engineering >  Ruby rails error: Bundler could not find compatible versions for gem "bundler":
Ruby rails error: Bundler could not find compatible versions for gem "bundler":

Time:08-14

Bundler could not find compatible versions for gem "bundler":

The error is below

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

    rails (= 6.1.4.6) was resolved to 6.1.4.6, which depends on
      bundler (>= 2.2.0)

  Current Bundler version:
    bundler (2.1.4)
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.2)', which is required by gem 'rails (= 6.1.4.6)', in any of the relevant sources:
  the local ruby installation

CodePudding user response:

Your solution is actually in the error message that you are getting. Run

gem install bundler

to install the latest version of bundler (that should satisfy the constraints

You can also specify a particular version of any gem by specifying the version flag. For example.

gem install bundler -v 2.2.0

CodePudding user response:

gem install bundler --version 2.2.19 --default

  • Related