Skip to content

/errors/bundler/could-not-find-gem-in-locally-installed-gems

Bundler: Could not find rake-13.2.1 in locally installed gems

The commands on this page have not been executed by our verification runner yet.updated
tool
Bundler
exit code
7
versions
Bundler 2.x
os
linux, macos, windows

Could not find rake-13.2.1 in locally installed gems (raised as Bundler::GemNotFound) means Gemfile.lock asks for a gem version that is not installed in the place Bundler is looking, for the Ruby that is running. It appears when you run bundle exec, rails or rake after the lock file changed but before bundle install. Run bundle install; if the error persists, compare the Ruby version, Bundler's path setting and the platforms in Gemfile.lock.

Fix

bash
bundle install           # installs what Gemfile.lock lists
bundle exec rake -T      # run tools through bundle exec

Bundler prints Run bundle install to install missing gems. after the error, and in most cases that is all that is needed.

When bundle install does not help

CheckCommandWhat to look for
Ruby versionruby -v and the RUBY VERSION section of Gemfile.lockA Ruby switch means a fresh, empty gem directory
Install locationbundle config get pathInstall and run must use the same BUNDLE_PATH (vendor/bundle or system)
Excluded groupsbundle config get withoutThe gem may be in a group that was skipped
Platformsgrep -A5 PLATFORMS Gemfile.lockYour platform (x86_64-linux, arm64-darwin...) must be listed for native gems
Frozen modebundle config get frozenIn frozen or deployment mode, Bundler will not re-resolve a lock that lacks your platform

Missing platform (Docker and CI)

A lock file created on macOS (arm64-darwin) may lack the Linux platform used in Docker or CI, so native gems such as nokogiri have no matching variant there. Add the platform and commit the lock file:

bash
bundle lock --add-platform x86_64-linux aarch64-linux
git add Gemfile.lock

Sources