Hello I’m investigating at using Ruby 3.3 but it fails at boot due to bootsnap. I got this error:
❯ rails c
/Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:120:in `<': comparison of String with nil failed (ArgumentError)
msg = " #{RUBY_VERSION < SINCE[gem] ? "will no longer be" : "is not"} part of the default gems since Ruby #{SINCE[gem]}."
^^^^^^^^^^
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:120:in `build_message'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:116:in `warning?'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:65:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/activesupport-7.1.2/lib/active_support/notifications/fanout.rb:3:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/activesupport-7.1.2/lib/active_support/notifications.rb:4:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/activesupport-7.1.2/lib/active_support/deprecation/behaviors.rb:3:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/activesupport-7.1.2/lib/active_support/deprecation.rb:45:in `<class:Deprecation>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/activesupport-7.1.2/lib/active_support/deprecation.rb:35:in `<module:ActiveSupport>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/activesupport-7.1.2/lib/active_support/deprecation.rb:5:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/application.rb:8:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails.rb:15:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/all.rb:5:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/projects/hotwire_2023-12/config/application.rb:3:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command/actions.rb:15:in `require_application!'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command/environment_argument.rb:31:in `require_application!'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command/actions.rb:19:in `boot_application!'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/commands/console/console_command.rb:105:in `perform'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command/base.rb:178:in `invoke_command'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command/base.rb:73:in `perform'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command.rb:71:in `block in invoke'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command.rb:149:in `with_argv'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/command.rb:69:in `invoke'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/railties-7.1.2/lib/rails/commands.rb:18:in `<main>'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `block (2 levels) in replace_require'
from /Users/thomas/.rbenv/versions/3.3.0-rc1/lib/ruby/gems/3.3.0+0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from bin/rails:4:in `<main>'
When I comment out the require "bootsnap/setup"
from the boot.rb file, there is no issue.
It fails here: ruby/lib/bundled_gems.rb at master · ruby/ruby · GitHub
- Without bootsnap the variable
name
are like:net-smtp
. - With bootsnap the variable
name
are like:-Users-thomas-.rbenv-versions-3.3.0-rc1-lib-ruby-3.3.0+0-mutex_m
It is a filepath that has been dash-ed here: ruby/lib/bundled_gems.rb at master · ruby/ruby · GitHub
I use a generated Rails 7.1.2 app with a single autogenerated scaffold on MacOS arm64. I have the same issue on non-hello-world project with Rails 6.1, 7.0 or 7.1.
Any idea?