Fixing a "config.handlebars" undefined method error

AI-generated summary

Fixing a “config.handlebars” undefined method error

zombiezen is experiencing an error when running bin/rake db:create db:migrate in a Discourse 1.4.5 dev environment. The error message indicates an undefined method handlebars for the Rails::Application::Configuration class.

sam suggests that the issue might be related to a security backport breaking the dev mode, advising to try rolling them back. zombiezen clarifies that they are trying to package Discourse as a Sandstorm app, which is why they chose the stable release. They also mention attempting to resolve the issue by checking out v1.4.0, but it didn’t work.

Unfortunately, zombiezen later mentions that they were unable to resolve the issue and gave up on packaging Discourse.

I’m trying to run Discourse 1.4.5 in a dev environment. When I go to run bin/rake db:create db:migrate, it crashes with:

rake aborted!
NoMethodError: undefined method `handlebars' for #<Rails::Application::Configuration:0x000000032c50a8>
/opt/app/.bundle/ruby/2.1.0/gems/railties-4.1.10/lib/rails/railtie/configuration.rb:95:in `method_missing'
/opt/app/config/application.rb:140:in `<class:Application>'
/opt/app/config/application.rb:19:in `<module:Discourse>'
/opt/app/config/application.rb:18:in `<top (required)>'
/opt/app/.bundle/ruby/2.1.0/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:247:in `block in require'
/opt/app/.bundle/ruby/2.1.0/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:232:in `load_dependency'
/opt/app/.bundle/ruby/2.1.0/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:247:in `require'
/opt/app/Rakefile:5:in `<top (required)>'
/opt/app/.bundle/ruby/2.1.0/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:241:in `load'
/opt/app/.bundle/ruby/2.1.0/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:241:in `block in load'
/opt/app/.bundle/ruby/2.1.0/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:232:in `load_dependency'
/opt/app/.bundle/ruby/2.1.0/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:241:in `load'
(See full trace by running task with --trace)

I’m not a Ruby developer per se, so much of the Gem/bundler specifics are lost on me. Any ideas on how to debug or fix this? I’ve tried explicitly adding a require for ember/handlebars/template in config/boot.rb, but no avail.

In general we don’t do dev on old releases, is there a reason you are setting up a dev environment for stable?

Its possible one of the security backports broke the dev mode, try rolling them back to see if that is the case.

I’m trying to package Discourse as a Sandstorm app, which is why I picked stable.

When you say security backports, do you mean in Discourse or in its dependencies?

EDIT: I ran git checkout v1.4.0 and attempted running again, but still hit the same issue.

Salut @zombiezen, as-tu résolu le problème ? Si oui, comment ?

Jamais. J’ai abandonné l’empaquetage de Discourse.