Bundler default gem dependency error

Chris Oliver

January 6, 2023

Have you seen the following error?

You have already activated uri 0.10.0, but your Gemfile requires uri 0.12.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem. (Gem::LoadError)
You have already activated strscan 3.0.1, but your Gemfile requires strscan 3.0.2.
Since strscan is a default gem, you can either remove your dependency on it or try updating to a
newer version of bundler that supports strscan as a default gem. (Gem::LoadError)

I've run into this with uri, strscan, and other gems. "bundle install" works fine, but running a command like "bundle exec rails assets:precompile" fails with the error above.

So what gives?

The Solution

The issue lies with Rubygems being outdated. If you update RubyGems, it will fix the issue.

gem update --system

P.S. You might enjoy following me on Twitter.


Comments