Bundler "the lockfile ... out of sync" with --deployment in CI
In deployment or frozen mode Bundler will not modify Gemfile.lock. It compared your Gemfile against the committed lockfile, found they differ, and refused to install because it is not allowed to update the lock in CI.
What this error means
bundle install --deployment (or with BUNDLE_FROZEN=true) fails listing gems added to or removed from the Gemfile, ending with "you should run bundle install elsewhere and add the updated Gemfile.lock to version control."
The dependencies in your gemfile changed, but the lockfile can't be updated because
frozen mode is set
You have added to the Gemfile:
* rack-cors
Run `bundle install` elsewhere and add the updated Gemfile.lock to version control.Common causes
The Gemfile was edited without relocking
A gem was added or removed in the Gemfile but Gemfile.lock was not regenerated, so frozen mode sees a mismatch.
The lockfile change was not committed
bundle install ran locally and updated the lock, but the updated Gemfile.lock was never committed, so CI checks out the old one.
How to fix it
Regenerate and commit the lockfile
- Run bundle install locally to update Gemfile.lock to match the Gemfile.
- Commit the updated Gemfile.lock alongside the Gemfile change.
- Re-run CI so deployment mode finds them in sync.
bundle install
git add Gemfile Gemfile.lockVerify both files are tracked
Confirm Gemfile.lock is committed and not ignored, so the runner installs against the same lock you generated.
git status --short Gemfile.lock
git check-ignore Gemfile.lock || echo trackedHow to prevent it
- Run bundle install and commit Gemfile.lock with every Gemfile edit.
- Never add Gemfile.lock to .gitignore for applications.
- Keep --deployment/frozen on in CI so drift fails fast.