bootsnapを使っているRailsアプリケーションでRuby2.6から2.7に更新すると以下の様なエラーが発生するようになった。
require 'bootsnap/setup'
している箇所で例外が発生する。
$ bundle exec rails s
Traceback (most recent call last):
24: from bin/rails:3:in `<main>'
23: from bin/rails:3:in `require_relative'
22: from /Users/murase/work/oacis/config/boot.rb:4:in `<top (required)>'
21: from /Users/murase/work/oacis/config/boot.rb:4:in `require'
20: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/setup.rb:30:in `<top (required)>'
19: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap.rb:30:in `setup'
18: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/compile_cache.rb:9:in `setup'
17: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
16: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
15: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
14: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
13: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
12: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
11: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
10: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `bloc
k in require_with_bootsnap_lfi'
9: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
8: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/compile_cache/iseq.rb:1:in `<top (required)>'
7: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
6: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
5: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
4: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
3: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
2: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
1: from /Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/murase/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': no implicit conversion of String into Integer (TypeError)
bootsnapの方でもissueとして上がっている。https://github.com/Shopify/bootsnap/issues/258
すでに修正が入っている。
1.4.4以前のバージョンだと発生するが、2020年1月時点の最新版1.4.5に更新することで解決する。