简体   繁体   English

无法在生产中使用滑轨

[英]Can't run rails in production

Working in development mode is working fine. 在开发模式下工作正常。 However when I do rails s production command I have the following error message : 但是,当我执行rails的生产命令时,出现以下错误消息:

rails s production
Exiting
Traceback (most recent call last):
        20: from bin/rails:4:in `<main>'
        19: from bin/rails:4:in `require'
        18: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
        17: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
        16: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
        15: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        14: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        13: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        12: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
        11: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
        10: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:135:in `block in perform'
         9: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:38:in `start'
         8: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:67:in `print_boot_information'
         7: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:96:in `use_puma?'
         6: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/rack-2.0.3/lib/rack/server.rb:301:in `server'
         5: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/rack-2.0.3/lib/rack/handler.rb:16:in `get'
         4: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/rack-2.0.3/lib/rack/handler.rb:74:in `try_require'
         3: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
         2: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
         1: from /home/cabox/.rvm/gems/ruby-2.5.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/home/cabox/.rvm/gems/ruby-2.5.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- rack/handler/production (LoadError)

I think this have to do with the last line of the error : 我认为这与错误的最后一行有关:

5.1.4/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- rack/handler/production (LoadError)

I tried to isntall the activesupport gem withouth any result. 我试图将所有的activesupport gem没有任何结果。 I'm running Ruby on Rails 5.1.4 with rvm running ruby 2.5.1. 我在Ruby on Rails 5.1.4上运行,而rvm运行ruby 2.5.1。 My OS is ubuntu 14.04. 我的操作系统是ubuntu 14.04。

the correct commmand is: 正确的命令是:

rails server -e production

Or you can do this with full options: 或者,您可以使用完整选项来执行此操作:

rails s -e production -p [your port] -b [your ip address] -P tmp/pids/test.pid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM