Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 7 - uninitialized constant Impressionist::Engine::ImpressionistController (NameError) #302

Open
raguila8 opened this issue Jan 29, 2022 · 3 comments

Comments

@raguila8
Copy link

After upgrading to rails 7 I'm getting the below error with the impressionist gem. When I start my local server.
uninitialized constant Impressionist::Engine::ImpressionistController (NameError)
ruby 3.0.2
rails 7.0.1
gem "impressionist", git: "https://github.com/charlotte-ruby/impressionist

This is the full stack after installing with bundler and running rails g impressionist:

/Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/impressionist-2.0.0/lib/impressionist/engine.rb:15:in `block (2 levels) in <class:Engine>': uninitialized constant Impressionist::Engine::ImpressionistController (NameError)
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:42:in `each'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:42:in `on_load'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/impressionist-2.0.0/lib/impressionist/engine.rb:14:in `block in <class:Engine>'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:32:in `run'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:347:in `each'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:347:in `call'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/application.rb:372:in `initialize!'
	from /Users/rodi/workspace/projects/tailwind_awesome/config/environment.rb:5:in `<main>'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:88:in `register'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/zeitwerk-2.5.3/lib/zeitwerk/kernel.rb:35:in `require'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/application.rb:348:in `require_environment!'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/actions.rb:28:in `require_environment!'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands/generate/generate_command.rb:21:in `perform'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/base.rb:87:in `perform'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command.rb:48:in `invoke'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands.rb:18:in `<main>'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:105:in `register'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	from /Users/rodi/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	from bin/rails:4:in `<main>'
@stingo
Copy link

stingo commented Feb 6, 2022

Facing the same issue with my existing app after an upgrade to rails 7 and ruby 3.0.1

/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/impressionist-e0db056a2ac0/lib/impressionist/engine.rb:15:in `block (2 levels) in <class:Engine>': uninitialized constant Impressionist::Engine::ImpressionistController (NameError)
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:42:in `each'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/activesupport-7.0.1/lib/active_support/lazy_load_hooks.rb:42:in `on_load'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/impressionist-e0db056a2ac0/lib/impressionist/engine.rb:14:in `block in <class:Engine>'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:32:in `run'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:347:in `each'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:347:in `call'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/application.rb:372:in `initialize!'
	from /Users/charliewiredu/Dev/uppro/config/environment.rb:5:in `<main>'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:42:in `require_relative'
	from config.ru:3:in `block in <main>'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:36:in `start'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:143:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/base.rb:87:in `perform'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command.rb:48:in `invoke'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands.rb:18:in `<main>'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/charliewiredu/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from bin/rails:4:in `<main>'

@JamesDullaghan
Copy link

Same as above

@mokevnin
Copy link

mokevnin commented Jan 13, 2023

found temporary solution:

# add to application.rb at the top
impressionist_dir = Gem::Specification.find_by_name('impressionist').gem_dir
require File.join(impressionist_dir, '/app/controllers/impressionist_controller.rb')

Enjoy :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants