首页 > 解决方案 > 在 Elastic Beanstalk 上无法访问 Rails 服务器

问题描述

我在 EB 上部署了一个 Rails 应用程序,但This site can’t be reached每次我尝试访问它的链接时它都会发出消息。我试图访问日志,但找不到任何有用的东西。但是,我尝试SSH进入EB Instance然后运行bundle exec rails c并收到以下错误:

/var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- listen (LoadError)
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/evented_file_update_checker.rb:6:in `<main>'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
from /var/app/current/config/environments/development.rb:72:in `block in <main>'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `instance_eval'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `configure'
from /var/app/current/config/environments/development.rb:3:in `<main>'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/engine.rb:571:in `block (2 levels) in <class:Engine>'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `each'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `block in <class:Engine>'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `each'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `tsort_each_child'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:415:in `call'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `each'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `call'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
from /opt/rubies/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
from /var/app/current/config/environment.rb:5:in `<main>'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/application.rb:367:in `require_environment!'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/command/actions.rb:28:in `require_environment!'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/commands/console/console_command.rb:101:in `perform'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in `<main>'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /var/app/current/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from bin/rails:5:in `<main>'

我试图检查该错误,但无法理解其根本原因,我知道它与 bootsnap 有关,但不确定是什么。

环境细节:

标签: ruby-on-railsrubyamazon-web-servicesamazon-elastic-beanstalk

解决方案


推荐阅读