Skip to content
Latchkey

Bundler "deployment mode requires a Gemfile.lock" in CI

You enabled deployment mode (bundle config set --local deployment true, or --deployment), which requires a committed Gemfile.lock. The runner has no lockfile, so Bundler refuses to resolve fresh in deployment mode.

What this error means

bundle install fails immediately under deployment mode complaining there is no Gemfile.lock, before fetching anything. It surfaces when CI sets deployment but the lockfile was never committed (or is gitignored).

bundler output
The deployment setting requires a Gemfile.lock. Please run `bundle install`
elsewhere and add the Gemfile.lock to version control.

Common causes

Deployment mode with no committed lockfile

Deployment mode is a stricter frozen mode: it forbids resolving on the fly and demands a Gemfile.lock be present. If the lockfile is missing or gitignored, there is nothing for Bundler to install from.

Lockfile generated but not checked in

A .gitignore entry for Gemfile.lock (common in gem libraries) means the runner never receives it, so deployment mode has no pinned set to honor.

How to fix it

Generate and commit the lockfile

Resolve locally without deployment mode, then commit Gemfile.lock so CI has it.

Terminal
bundle install
git add Gemfile.lock && git commit -m "Add Gemfile.lock for deployment"

Stop ignoring the lockfile for apps

  1. For an application, remove Gemfile.lock from .gitignore - it must be versioned.
  2. For a gem library, do not enable deployment mode in CI; run a plain bundle install instead.
  3. Confirm the checkout step actually ships Gemfile.lock to the runner.

How to prevent it

  • Commit Gemfile.lock for applications and keep it out of .gitignore.
  • Only enable deployment mode where a committed lockfile is guaranteed.
  • For gem libraries, prefer a plain install over deployment mode in CI.

Frequently asked questions

What causes ""deployment mode requires""?
Deployment mode is a stricter frozen mode: it forbids resolving on the fly and demands a Gemfile.lock be present. If the lockfile is missing or gitignored, there is nothing for Bundler to install from.
How do I fix "deployment mode requires"?
Resolve locally without deployment mode, then commit Gemfile.lock so CI has it.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card