Closed jaehocho closed 2 years ago
I have installed stimulus-rails gem on my rails 7 application. When I run the application, I get the following error.
The error is
Uncaught exception: undefined method `application' for Stimulus::Rails:Module
in lib/stimulus/engin.rb, Rails is somehow being interpreted as Stimulus::Rails instead of root class ::Rails.
Does anyone know how to handle this? Help would be greatly appreciated.
The following is the backtrace
=> Booting WEBrick => Rails 7.0.2.4 application starting in development http://0.0.0.0:3002 => Run `bin/rails server --help` for more startup options Exiting Uncaught exception: undefined method `application' for Stimulus::Rails:Module /Users/jae/.rvm/gems/ruby-3.0.4/gems/stimulus-rails-1.0.0/lib/stimulus/engine.rb:4:in `block in <class:Engine>' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/initializable.rb:32:in `instance_exec' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/initializable.rb:32:in `run' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/initializable.rb:61:in `block in run_initializers' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:347:in `each' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:347:in `call' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each' /Users/jae/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/initializable.rb:60:in `run_initializers' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/application.rb:372:in `initialize!' /Users/jae/src/reiance2/config/environment.rb:5:in `<main>' /Users/jae/.rvm/gems/ruby-3.0.4/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/jae/.rvm/gems/ruby-3.0.4/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/jae/.rvm/gems/ruby-3.0.4/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require' config.ru:3:in `block in <main>' /Users/jae/.rvm/gems/ruby-3.0.4/gems/rack-2.2.4/lib/rack/builder.rb:116:in `eval' /Users/jae/.rvm/gems/ruby-3.0.4/gems/rack-2.2.4/lib/rack/builder.rb:116:in `new_from_string' /Users/jae/.rvm/gems/ruby-3.0.4/gems/rack-2.2.4/lib/rack/builder.rb:105:in `load_file' /Users/jae/.rvm/gems/ruby-3.0.4/gems/rack-2.2.4/lib/rack/builder.rb:66:in `parse_file' /Users/jae/.rvm/gems/ruby-3.0.4/gems/rack-2.2.4/lib/rack/server.rb:349:in `build_app_and_options_from_config' /Users/jae/.rvm/gems/ruby-3.0.4/gems/rack-2.2.4/lib/rack/server.rb:249:in `app' /Users/jae/.rvm/gems/ruby-3.0.4/gems/rack-2.2.4/lib/rack/server.rb:422:in `wrapped_app' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/commands/server/server_command.rb:36:in `start' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/commands/server/server_command.rb:143:in `block in perform' <internal:kernel>:90:in `tap' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/commands/server/server_command.rb:134:in `perform' /Users/jae/.rvm/gems/ruby-3.0.4/gems/thor-1.2.1/lib/thor/command.rb:27:in `run' /Users/jae/.rvm/gems/ruby-3.0.4/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command' /Users/jae/.rvm/gems/ruby-3.0.4/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/command/base.rb:87:in `perform' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/command.rb:48:in `invoke' /Users/jae/.rvm/gems/ruby-3.0.4/gems/railties-7.0.2.4/lib/rails/commands.rb:18:in `<main>' /Users/jae/.rvm/gems/ruby-3.0.4/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/jae/.rvm/gems/ruby-3.0.4/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /Users/jae/src/reiance2/bin/rails:9:in `<top (required)>' Process finished with exit code 0
Issue was due to stimulusjs-rails gem. I removed the gem and it worked. Stimulusjs-rails defined Stimulus::Rails
I have installed stimulus-rails gem on my rails 7 application. When I run the application, I get the following error.
The error is
in lib/stimulus/engin.rb, Rails is somehow being interpreted as Stimulus::Rails instead of root class ::Rails.
Does anyone know how to handle this? Help would be greatly appreciated.
The following is the backtrace