启动rails控制台时出错

时间:2018-05-04 00:14:07

标签: ruby-on-rails-5 ruby-2.4 ubuntu-18.04

当我尝试启动rails控制台时,我收到以下错误

/usr/lib/ruby/vendor_ruby/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x000055af3aee4550> (NoMethodError)
        from /home/alizain/www/WorkStationMetrices/config/application.rb:12:in `<class:Application>'
        from /home/alizain/www/WorkStationMetrices/config/application.rb:10:in `<module:WorkstationMetrics>'
        from /home/alizain/www/WorkStationMetrices/config/application.rb:9:in `<top (required)>'
        from /home/alizain/www/WorkStationMetrices/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
        from /home/alizain/www/WorkStationMetrices/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
        from /home/alizain/www/WorkStationMetrices/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
        from /home/alizain/www/WorkStationMetrices/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
        from /home/alizain/www/WorkStationMetrices/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
        from /home/alizain/www/WorkStationMetrices/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
        from /home/alizain/www/WorkStationMetrices/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from -e:1:in `<main>'

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

根据给出的错误堆栈,您似乎在应用程序加载期间加载配置时遇到问题。

下面提到的链接也解决了同样的问题。

error "Undefinded method "load_defaults" " when trying to deploy app on Heroku

希望它有所帮助!!