Gem::GemNotFoundException: can't find gem bundler (>= 0.a)m Error

Received the following error beginning about 11 hours ago, when I run my build this on CircleCI:

#!/bin/bash -eo pipefail
bundle install --jobs=4 --retry=3 --path vendor/bundle
Gem::GemNotFoundException: can't find gem bundler (>= 0.a) with executable bundle
find_spec_for_exe at /opt/jruby/lib/ruby/stdlib/rubygems.rb:289
activate_bin_path at /opt/jruby/lib/ruby/stdlib/rubygems.rb:308
         <main> at /opt/jruby/bin/bundle:23
Exited with code 1

The newer version of bundler is different from the gemfile.lock file. When I removed the gemfile.lock file and installed bundler, ran bundle install again: I got the following error:

bundle install --jobs=4 --retry=3 --path vendor/bundle
Fetching gem metadata from
Fetching gem metadata from
Resolving dependencies.........
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 4.2.11) java was resolved to 4.2.11, which depends on
      bundler (&lt; 2.0, &gt;= 1.3.0) java

  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 (&lt; 2.0, &gt;= 1.3.0)', which is required by gem 'rails
(= 4.2.11)', in any of the sources.

Even if I install gem install bundler -v 1.17.2 (which is the version I want to use)
The version of bundler I run in the command line returns 2.0.1

The configuration was working fine until 11 hours ago with this image

The rails version I am using is 4.2.11, which seems to incompatible with bundler version 2.0.1.

Eventually, I would like to update my rails version 5, however we needs this working now. How can I use bundler version 1.17.2 instead of 2.0.1?

1 Like

We were able to fix this by updating our CircleCI config to install a specific version of Bundler before running bundle install.

- run:
          name: install dependencies
          command: |
            gem install bundler -v 1.17.2
            bundle install --jobs=4 --retry=3 --path vendor/bundle

It is likely to result from upstream image changes outside of CircleCI’s control. If you get stuck with this sort of thing, pinning your docker image to a specific sha256 hash can be a handy short-term fix.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.