rails: zeitwerk:check fails on 6.0.2
Steps to reproduce
zeitwerk:check
fails on a newly created project.
$ rails new foo
$ cd foo
$ ./bin/rails zeitwerk:check
This might be related to #37756.
Expected behavior
Just works.
Actual behavior
Hold on, I am eager loading the application.
rails aborted!
NoMethodError: undefined method `eager_load_paths' for #<I18n::Config:0x000055fe6c0abef8>
/usr/local/bundle/gems/railties-6.0.2/lib/rails/tasks/zeitwerk.rake:57:in `block (3 levels) in <main>'
/usr/local/bundle/gems/railties-6.0.2/lib/rails/tasks/zeitwerk.rake:56:in `map'
/usr/local/bundle/gems/railties-6.0.2/lib/rails/tasks/zeitwerk.rake:56:in `block (2 levels) in <main>'
/usr/local/bundle/gems/railties-6.0.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/usr/local/bundle/gems/railties-6.0.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/bundle/gems/railties-6.0.2/lib/rails/command.rb:48:in `invoke'
/usr/local/bundle/gems/railties-6.0.2/lib/rails/commands.rb:18:in `<main>'
/usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/usr/local/bundle/gems/activesupport-6.0.2/lib/active_support/dependencies.rb:325:in `block in require'
/usr/local/bundle/gems/activesupport-6.0.2/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/local/bundle/gems/activesupport-6.0.2/lib/active_support/dependencies.rb:325:in `require'
./bin/rails:4:in `<main>'
Tasks: TOP => zeitwerk:check
(See full trace by running task with --trace)
System configuration
Rails version: 6.0.2
Ruby version: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 22
- Comments: 21 (13 by maintainers)
Thanks!
Let me ask @rafaelfranca… are there any plans for 6.0.3?
Fixed in da28edf9baf0bd83b5308564bdcd8f4673b492bd. I’ll rewrite this with more time, but meanwhile the regresssion is no longer present in
master
or6-0-stable
.@pedrofurtado yes!
I’ll have a look soon.
Any good workaround in the meantime to be able to run
zeitwerk:check
on Rails 6.0.2(.1)? Annoying not to have this tool available.I guess one possibility is to copy the whole patched rake task into your local app (it’s not that big) at
./lib/tasks
, perhaps changing the namespace tolocal_zeitwerk
to avoid confusion.Yep, that seemed to work for me.
Not sure if it is any help but was looking at this just now. This looks like an issue with the config object in i18n. The zeitwerk rake task is asking each of the config objects for their
eager_load_paths
. The i18n config object is the only one in the usual list of the Rails.configuration.eager_load_namespaces that doesn’t defineeager_load_paths
.I’m entirely not sure how to investigate further in such as way as to be of any help.