仅在生产环境中缺少ApplicationController

时间:2019-02-25 19:32:16

标签: ruby-on-rails ruby-on-rails-5 jsonapi-rails

我在生产环境中运行应用程序时遇到问题,当我在开发环境中运行时一切正常,但是生产环境显示很多错误,我不知道为什么,我在做什么错了?

Adam:service service$ RAILS_ENV=production rails s
=> Booting Puma
=> Rails 5.2.0 application starting in production
=> Run 'rails server -h' for more startup options 
    Exiting
    Traceback (most recent call last): 
        83: from bin/rails:3:in '<main>'
    82: from bin/rails:3:in 'load'
    81: from /Users/service/bin/spring:15:in '<top (required)>'
'  80: from /Users/service/bin/spring:15:in 'require'
    79: from /Users/service/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in '<top (required)>'
    78: from /Users/service/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in 'load'
'  77: from /Users/service/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/bin/spring:49:in '<top (required)>'
    76: from /Users/service/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client.rb:30:in 'run'
    75: from /Users/service/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in 'call'
'  74: from /Users/service/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in 'call'
    73: from /Users/service/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in 'load'
    72: from /Users/service/bin/rails:9:in '<top (required)>'
'  71: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in 'require'
    70: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in 'require_with_bootsnap_lfi'
    69: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in 'register'
'  68: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in 'block in require_with_bootsnap_lfi'
    67: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in 'require'
    66: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands.rb:18:in '<main>'
'  65: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/command.rb:46:in 'invoke'
    64: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/command/base.rb:65:in 'perform'
    63: from /Users/service/.rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor.rb:387:in 'dispatch'
'  62: from /Users/service/.rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor/invocation.rb:126:in 'invoke_command'
    61: from /Users/service/.rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor/command.rb:27:in 'run'
    60: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in 'perform'
'  59: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in 'tap'
    58: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in 'block in perform'
    57: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:53:in 'start'
'  56: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/server.rb:283:in 'start'
    55: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/server.rb:354:in 'wrapped_app'
    54: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:27:in 'app'
'  53: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/server.rb:219:in 'app'
    52: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/server.rb:319:in 'build_app_and_options_from_config'
    51: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:40:in 'parse_file'
'  50: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:49:in 'new_from_string'
    49: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:49:in 'eval'
    48: from config.ru:in '<main>'
'  47: from config.ru:in 'new'
    46: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:55:in 'initialize'
    45: from /Users/service/.rvm/gems/ruby-2.5.1/gems/rack-2.0.5/lib/rack/builder.rb:55:in 'instance_eval'
'  44: from config.ru:3:in 'block in <main>'
    43: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in 'require_relative'
    42: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in 'require'
'  41: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in 'require_with_bootsnap_lfi'
    40: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in 'register'
    39: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in 'block in require_with_bootsnap_lfi'
'  38: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in 'require'
    37: from /Users/service/config/environment.rb:5:in '<main>'
    36: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/application.rb:361:in 'initialize!'
'  35: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:60:in 'run_initializers'
    34: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in 'tsort_each'
    33: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in 'tsort_each'
'  32: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in 'each_strongly_connected_component'
    31: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in 'call'
    30: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in 'each'
'  29: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in 'block in each_strongly_connected_component'
    28: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in 'each_strongly_connected_component_from'
    27: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in 'block (2 levels) in each_strongly_connected_component'
'  26: from /Users/service/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in 'block in tsort_each'
    25: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:61:in 'block in run_initializers'
    24: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:32:in 'run'
'  23: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/initializable.rb:32:in 'instance_exec'
    22: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/application/finisher.rb:69:in 'block in <module:Finisher>'
    21: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/application/finisher.rb:69:in 'each'
'  20: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:356:in 'eager_load!'
    19: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:475:in 'eager_load!'
    18: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:475:in 'each'
'  17: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:477:in 'block in eager_load!'
    16: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:477:in 'each'
    15: from /Users/service/.rvm/gems/ruby-2.5.1/gems/railties-5.2.0/lib/rails/engine.rb:478:in 'block (2 levels) in eager_load!'
'  14: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in 'depend_on'
    13: from /Users/service/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:13:in 'loading'
    12: from /Users/service/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/concurrency/share_lock.rb:151:in 'exclusive'
'  11: from /Users/service/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:14:in 'block in loading'
    10: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in 'require'
     9: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in 'require_with_bootsnap_lfi'
'  8: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in 'register'
     7: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in 'block in require_with_bootsnap_lfi'
     6: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in 'require'
'  5: from /Users/service/.rvm/gems/ruby-2.5.1/gems/notifications-0.6.0/app/controllers/notifications/application_controller.rb:1:in '<main>'
     4: from /Users/service/.rvm/gems/ruby-2.5.1/gems/notifications-0.6.0/app/controllers/notifications/application_controller.rb:2:in '<module:Notifications>'
     3: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:42:in 'load_missing_constant'
'  2: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in 'rescue in load_missing_constant'
     1: from /Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in 'without_bootsnap_cache'
/Users/service/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in 'block in load_missing_constant': uninitialized constant ApplicationController (NameError)

有人知道为什么生产环境中缺少ApplicationController吗?它的api rails应用程序,所以ApplicationController

Adam:service$ rails s
=> Booting Puma
=> Rails 5.2.0 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.11.4 (ruby 2.5.1-p57), codename: Love Song
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

0 个答案:

没有答案