Bundler error: Downloading gem revealed dependencies not in the API

Recent Bundler (1.16.1) started complaining about missing dependencies in the Gemfile. This is due to a stricter handling of specifications (see attached link).

The error message looks like this:

Downloading example-gem-1.2.3 revealed dependencies not in the API or the lockfile (other-gem (< 3)).
Either installing with `--full-index` or running `bundle update example-gem` should fix the problem.

However, bundle install --full-index did not any better for me, and bundle update is not always a viable solution.

Easiest solution

Open Gemfile.lock and add the dependencies manually by looking for example-gem and adding its dependencies underneath. You may even copy them from the error message.

...

GEM
  specs:
    ...
    example-gem (1.2.3)
+     other-gem (< 3)
    
DEPENDENCIES
  ... 

bundle install should succeed now. If it doesn't, you have probably screwed its syntax. Check your Gemfile.lock again.

Dominik Schöler About 6 years ago