“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey
Senior Software Engineer, UK

Bundler issue on Ruby 3.3.0 Upgrade

Honestly, Ruby 3.2.2 to Ruby 3.3.0 upgrades have been really painless. I’ve hit every server and installed Ruby 3.3.0 with YJIT enabled and we’re ready to go as soon as the new Ruby_3.3.0 branches specs pass.

However, this one is rather annoying.

% bundle install
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies....................
--- ERROR REPORT TEMPLATE -------------------------------------------------------

NoMethodError: undefined method `version' for an instance of Bundler::IncompleteSpecification

This current Gemfile.lock indicates we last bundled this with Bunder 2.3.20. I know the latest version is 2.5.5

RUBY VERSION
   ruby 3.2.2p53

BUNDLED WITH
   2.3.20

Ok in the Gemfile we have locked to a specific version of bundler, I’m not sure why. I’d think that bundler is pretty safe to allow the host system to have whatever version is installed manage this.

gem 'bundler', '~> 2.3.8'

If I remove this line from the Gemfile, nothing changes. I still get Unfortunately, an unexpected error occurred, and Bundler cannot continue. It’s expecting that version of bundler to manage it still.

Bundler       2.3.20
  Platforms   ruby, arm64-darwin-23
Ruby          3.3.0p0 (2023-12-25 revision 5124f9ac7513eb590c37717337c430cb93caa151) [arm64-darwin-23]
  Full Path   /Users/rl/.asdf/installs/ruby/3.3.0/bin/ruby
  Config Dir  /Users/rl/.asdf/installs/ruby/3.3.0/etc
RubyGems      3.5.3
  Gem Home    /Users/rl/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0
  Gem Path    /Users/rl/.gem/ruby/3.3.0:/Users/rl/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0
  User Home   /Users/rl
  User Path   /Users/rl/.gem/ruby/3.3.0
  Bin Dir     /Users/rl/.asdf/installs/ruby/3.3.0/bin
OpenSSL       
  Compiled    OpenSSL 3.2.0 23 Nov 2023
  Loaded      OpenSSL 3.2.0 23 Nov 2023
  Cert File   /opt/homebrew/etc/openssl@3/cert.pem
  Cert Dir    /opt/homebrew/etc/openssl@3/certs
Tools         
  Git         2.39.3 (Apple Git-145)
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Even if 2.5.5 is the default.

% gem list bundler

*** LOCAL GEMS ***

bundler (2.5.5, default: 2.5.3, 2.4.21, 2.4.0, 2.3.20)
bundler-audit (0.9.1)
capistrano-bundler (2.1.0, 2.0.1)

So I have to force bundler to use the correct version for this bundle install to work. And success.

bundle _2.5.5_ install
---8<---
Bundle complete! 115 Gemfile dependencies, 321 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
GPK of the Day Charred CHAD