Rails 服务器立即退出 - Rails 5.2.0 和 Ruby 2.5.1
Rails server exiting immediately - Rails 5.2.0 and Ruby 2.5.1
我使用的是 Rails 5.2.0 和 Ruby 2.4.0。一切正常。所以我将 Ruby 升级到 2.5.1 并再次 运行 捆绑包。之后当我 运行 "Rails S" 我有错误:
rails s
=> Booting Puma
=> Rails 5.2.0 application starting in development
=> Run `rails server -h` for more startup options
Exiting
Traceback (most recent call last):
34: from bin/rails:3:in `<main>'
33: from bin/rails:3:in `load'
32: from /Users/felipemarcon/projects/marcon_portfolio/bin/spring:15:in `<top (required)>'
31: from /Users/felipemarcon/projects/marcon_portfolio/bin/spring:15:in `require'
30: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
29: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
28: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
27: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
26: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
25: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
24: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
23: from /Users/felipemarcon/projects/marcon_portfolio/bin/rails:9:in `<top (required)>'
22: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
21: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
20: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
19: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
18: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
17: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
16: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
15: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
14: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
13: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke'
12: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform'
11: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
10: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
9: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
8: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform'
7: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap'
6: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
5: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:53:in `start'
4: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/rack-2.0.4/lib/rack/server.rb:297:in `start'
3: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/rack/handler/puma.rb:66:in `run'
2: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/rack/handler/puma.rb:66:in `new'
1: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/puma/launcher.rb:74:in `initialize'
/Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/puma/launcher.rb:74:in `chdir': No such file or directory @ dir_s_chdir - /{path_to_your_app}/current (Errno::ENOENT)
发生什么事了?我该如何解决?
谢谢。
我解决了这个问题。只是文件 config/puma.rb 的问题。 Ruby 2.5.1 和 Rails 5.2.0.
现在一切正常
我的puma.rb是这样的:
environment "production"
bind "unix:///{path_to_your_app}/shared/tmp/sockets/puma.sock"
pidfile "/{path_to_your_app}/shared/tmp/pids/puma.pid"
state_path "/{path_to_your_app}/shared/tmp/sockets/puma.state"
directory "/{path_to_your_app}/current"
workers 2
threads 1,2
daemonize true
activate_control_app 'unix:///{path_to_your_app}/shared/tmp/sockets/pumactl.sock'
prune_bundler
我只是更改为(初始配置):
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count
port ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { "development" }
plugin :tmp_restart
bind "unix:/home/rails/marcon/shared/tmp/sockets/puma.sock" if ENV.fetch("RAILS_ENV") == 'production'
总之,谢谢回答的人。
我使用的是 Rails 5.2.0 和 Ruby 2.4.0。一切正常。所以我将 Ruby 升级到 2.5.1 并再次 运行 捆绑包。之后当我 运行 "Rails S" 我有错误:
rails s
=> Booting Puma
=> Rails 5.2.0 application starting in development
=> Run `rails server -h` for more startup options
Exiting
Traceback (most recent call last):
34: from bin/rails:3:in `<main>'
33: from bin/rails:3:in `load'
32: from /Users/felipemarcon/projects/marcon_portfolio/bin/spring:15:in `<top (required)>'
31: from /Users/felipemarcon/projects/marcon_portfolio/bin/spring:15:in `require'
30: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
29: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
28: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
27: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
26: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
25: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
24: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
23: from /Users/felipemarcon/projects/marcon_portfolio/bin/rails:9:in `<top (required)>'
22: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
21: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
20: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
19: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
18: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
17: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
16: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
15: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
14: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
13: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke'
12: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform'
11: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
10: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
9: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
8: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform'
7: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap'
6: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
5: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:53:in `start'
4: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/rack-2.0.4/lib/rack/server.rb:297:in `start'
3: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/rack/handler/puma.rb:66:in `run'
2: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/rack/handler/puma.rb:66:in `new'
1: from /Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/puma/launcher.rb:74:in `initialize'
/Users/felipemarcon/.rvm/gems/ruby-2.5.1@marconPortfolio/gems/puma-3.11.4/lib/puma/launcher.rb:74:in `chdir': No such file or directory @ dir_s_chdir - /{path_to_your_app}/current (Errno::ENOENT)
发生什么事了?我该如何解决?
谢谢。
我解决了这个问题。只是文件 config/puma.rb 的问题。 Ruby 2.5.1 和 Rails 5.2.0.
现在一切正常我的puma.rb是这样的:
environment "production"
bind "unix:///{path_to_your_app}/shared/tmp/sockets/puma.sock"
pidfile "/{path_to_your_app}/shared/tmp/pids/puma.pid"
state_path "/{path_to_your_app}/shared/tmp/sockets/puma.state"
directory "/{path_to_your_app}/current"
workers 2
threads 1,2
daemonize true
activate_control_app 'unix:///{path_to_your_app}/shared/tmp/sockets/pumactl.sock'
prune_bundler
我只是更改为(初始配置):
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count
port ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { "development" }
plugin :tmp_restart
bind "unix:/home/rails/marcon/shared/tmp/sockets/puma.sock" if ENV.fetch("RAILS_ENV") == 'production'
总之,谢谢回答的人。