Search code examples
ruby-on-railsrubyinstallationrubygemsbundler

Ruby on Rails: Bundle install could not find compatible versions for “bundler” gem


I'm trying to run the command bundle install and getting the following error -

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    blog_posts was resolved to 0.0.1, which depends on
      blog_viewers was resolved to 0.0.1, which depends on
        rails (~> 4.2) was resolved to 4.2.7, which depends on
          bundler (< 2.0, >= 1.3.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.0, >= 1.3.0)', which is required by gem 'rails (~> 4.2)', in any of the sources.

If I downgrade the version then I'm getting the following error -

Traceback (most recent call last):
        1: from /home/user/.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'
/home/user/.rbenv/versions/2.6.6/bin/bundle:23:in `load': cannot load such file -- /home/user/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle (LoadError)

NOTE - The default bundler version is 1.17.3

Is there any way to resolve this issue? Any kind of help would be greatly appreciated.


Solution

  • Try gem install bundler and again bundle install