Bundler "Could not find gem" in CI - Fix Missing Gems
Bundler resolved your Gemfile and could not locate one of the requested gems on any configured source. Almost always a typo, a version that no longer exists, or a private gem on a source you have not declared.
What this error means
bundle install or bundle lock aborts before installing anything, printing that it could not find the gem in the configured rubygems repository or sources. Re-running does not help - the gem genuinely is not on the sources Bundler is searching.
Could not find gem 'rails (>= 0)' in rubygems repository
https://rubygems.org/ or installed locally.
The source contains the following gems matching 'rails':
* railsCommon causes
Misspelled gem name or wrong version
The name in the Gemfile differs from the published gem (rails vs rails), or you pinned a version that was yanked. Bundler often prints a "did you mean" hint with the closest match.
The gem lives on a private source
If the dependency is internal, the default rubygems.org source has nothing. Without a source block or a configured Gemfury/private index, Bundler cannot see it.
A platform-only version that does not exist
A version constraint may have releases for some platforms but not the one resolving, leaving Bundler with no candidate that satisfies the requirement.
How to fix it
Verify the exact name and available versions
Search the real gem name and confirm which versions are published.
gem search '^rails$' --remote
gem list --remote railsPoint Bundler at the right source
Scope a private gem to its own source so Bundler knows where to look.
source 'https://rubygems.org'
source 'https://gems.example.com' do
gem 'your-internal-gem'
endRe-resolve after fixing the name
bundle lock --update
bundle installHow to prevent it
- Commit Gemfile.lock so CI installs the exact resolved set.
- Scope private gems to an explicit source block.
- Pin versions you know are published, not yanked releases.