HugoHasenbein / redmine_more_previews

Redmine plugin to preview various file types in redmine's preview pane
https://www.redmine.org/plugins/redmine_more_previews
GNU General Public License v2.0
46 stars 15 forks source link

I have a question about the "Zeitwerk::NameError" error. #69

Closed ssaurabi7 closed 1 year ago

ssaurabi7 commented 1 year ago

First of all, thank you for this amazing plugin.

I am trying to install this plugin on Redmine 5.0.5. I have attempted to install it on a virtual machine (bitnami-redmine-5.0.5-3-r05-linux-vm-debian-11-x86_64-nami.ova) using the following link: https://bitnami.com/stack/redmine/virtual-machine

After running "bundle install", when I tried to restart Redmine using the command "sudo /opt/bitnami/ctlscript.sh restart", it failed to start.

When I tried to connect to Redmine, I received the following error message:

We're sorry, but something went wrong. The issue has been logged for investigation. Please try again later.

Here is the output of "sudo rails console -e production".

Could you please help me with this issue?

bitnami@debian:~/stack/redmine$ sudo rails console -e production Beginning in Rails 4, Rails ships with arailsbinstub at ./bin/rails that should be used instead of the Bundler-generatedrails` binstub.

If you are seeing this message, your binstub at ./bin/rails was generated by Bundler instead of Rails.

You might need to regenerate your rails binstub locally and add it to source control:

rails app:update:bin # Bear in mind this generates other binstubs

too that you may or may not want (like yarn)

If you already have Rails binstubs in source control, you might be inadvertently overwriting them during deployment by using bundle install with the --binstubs option.

If your application was created prior to Rails 4, here's how to upgrade:

bundle config --delete bin # Turn off Bundler's stub generator rails app:update:bin # Use the new Rails executables git add bin # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app, generate it and add it to source control:

bundle binstubs some-gem-name git add bin/new-executable /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/callbacks.rb:25:inon_file_autoloaded': expected file /opt/bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/modules.rb to define constant RedmineMorePreviews::Modules, but didn't (Zeitwerk::NameError) from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:31:in require' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/modules/shell.rb:27:in' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/modules/shell.rb:26:in <top (required)>' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/modules.rb:23:inrequire_relative' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/modules.rb:23:in <top (required)>' from /opt/bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews.rb:25:inrequire_relative' from /opt/bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews.rb:25:in <top (required)>' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:inrequire' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in require' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:30:inrequire' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/constants/defaults.rb:22:in <top (required)>' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/constants.rb:23:inrequire_relative' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/constants.rb:23:in <top (required)>' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews.rb:23:inrequire_relative' from /bitnami/redmine/plugins/redmine_more_previews/lib/redmine_more_previews.rb:23:in <top (required)>' from /opt/bitnami/redmine/plugins/redmine_more_previews/init.rb:147:inrequire_relative' from /opt/bitnami/redmine/plugins/redmine_more_previews/init.rb:147:in <top (required)>' from /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:31:inload' from /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:31:in run_initializer' from /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:108:ineach' from /opt/bitnami/redmine/lib/redmine/plugin_loader.rb:108:in block in load' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:427:ininstance_exec' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:427:in block in make_lambda' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:198:inblock (2 levels) in halting' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:604:in block (2 levels) in default_terminator' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:603:incatch' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:603:in block in default_terminator' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:199:inblock in halting' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:512:in block in invoke_before' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:512:ineach' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:512:in invoke_before' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/callbacks.rb:105:inrun_callbacks' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/reloader.rb:88:in prepare!' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/application/finisher.rb:124:inblock in ' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:32:in instance_exec' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:32:inrun' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:61:in block in run_initializers' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:228:inblock in tsort_each' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:431:ineach_strongly_connected_component_from' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:349:in block in each_strongly_connected_component' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:347:ineach' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:347:in call' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:347:ineach_strongly_connected_component' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:226:in tsort_each' from /opt/bitnami/ruby/lib/ruby/3.0.0/tsort.rb:205:intsort_each' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:60:in run_initializers' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/application.rb:391:ininitialize!' from /opt/bitnami/redmine/config/environment.rb:16:in <top (required)>' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:inrequire' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in require' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:inrequire' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in block in require' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:inload_dependency' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in require' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/application.rb:367:inrequire_environment!' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/command/actions.rb:28:in require_environment!' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/command/actions.rb:15:inrequire_application_and_environment!' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/commands/console/console_command.rb:101:in perform' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:inrun' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in invoke_command' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:indispatch' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/command/base.rb:69:in perform' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/command.rb:48:ininvoke' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/commands.rb:18:in <top (required)>' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:inrequire' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in require' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/app_loader.rb:59:inblock in exec_app' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/app_loader.rb:48:in loop' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/app_loader.rb:48:inexec_app' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/lib/rails/cli.rb:7:in <top (required)>' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:inrequire' from <internal:/opt/bitnami/ruby/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in require' from /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.2/exe/rails:10:in<top (required)>' from /opt/bitnami/redmine/bin/rails:27:in load' from /opt/bitnami/redmine/bin/rails:27:in

' bitnami@debian:~/stack/redmine$ `

karstenmtr commented 1 year ago

Had the same problem. I just moved some files one folder up and renamed them to circumvent the error. Basically is did this in the redmine_more_previews folder:

cd lib/redmine_more_previews
mv constants.rb constants.orig
mv hooks.rb hooks.orig
mv modules.rb modules.orig
cp constants/defaults.rb constants.rb
cp hooks/icon_css.rb hooks.rb
cp modules/shell.rb modules.rb

Surely this is not the best way to solve this, but Redmine is working again.