【问题标题】:Error Rails 4 console on staging or production暂存或生产中的错误 Rails 4 控制台
【发布时间】:2017-09-28 20:17:55
【问题描述】:

使用以下命令加入我的办公室:

RAILS_ENV=production rails s production

我收到以下错误:

/usr/local/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/handler.rb:78:in `require': cannot load such file -- rack/handler/production (LoadError)

请帮忙!!

【问题讨论】:

  • 可悲的是,运行rails s production 不像rails c production 那样工作..

标签: ruby-on-rails ruby ruby-on-rails-4.2


【解决方案1】:

运行此命令以production 模式运行rails 服务器

rails s -e production

【讨论】:

    【解决方案2】:

    猜测:

    RAILS_ENV=production rails s production
    

    到:

    RAILS_ENV=production rails s
    

    【讨论】:

    • 也可以使用env=production rails s
    【解决方案3】:

    确定这是你的命令的问题

    RAILS_ENV=production rails s production 
    

    改成:

    RAILS_ENV=production rails s
    

    rails s 命令的用法是:

    Usage: rails server [mongrel, thin, etc] [options]
    
    -p, --port=port                  Runs Rails on the specified port.
                                     Default: 3000
    -b, --binding=ip                 Binds Rails to the specified ip.
                                     Default: 0.0.0.0
    -c, --config=file                Use custom rackup configuration file
    -d, --daemon                     Make server run as a Daemon.
    -u, --debugger                   Enable ruby-debugging for the server.
    -e, --environment=name           Specifies the environment to run this server under (test/development/production).
                                     Default: development
    -P, --pid=pid                    Specifies the PID file.
                                     Default: tmp/pids/server.pid
    -h, --help                       Show this help message.
    

    所以rails s 后面的词应该是您想要运行应用程序的服务器,即(Thin、WEBrick、FastCGI、CGI、SCGI 和 LiteSpeed。)

    rails s thin
    => Booting Thin
    => Rails 3.2.16 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    
    rails s WEBrick
    => Booting WEBrick
    => Rails 3.2.16 application starting in development on http://0.0.0.0:3000
    => Ctrl-C to shutdown server
    

    【讨论】:

    • 使用RAILS_ENV=production rails s,服务启动,-*=> Booting WEBrick* -*=> Rails 4.2.4 application starting in production on http: // localhost: 3000 *=> Run 'rails server -h 获得更多启动选项 *=> Ctrl-C 关闭服务器 *[22/02/2016 15:00:23] INFO WEBrick 1.3.1 *[22/02/2016 15:00:23] 信息 ruby​​ 2.2.2 (13/04/2015) [x86_64-linux] *[22/02/2016 15:00:23] 信息 WEBrick :: HTTPServer # 开始: pid = 1248 port = 3000` 当我去我的服务器时,我只能看到公共文件夹中的文件。
    【解决方案4】:

    它作为本地运行,并使用 WEBrick 1.3.1 我想使用 apache + 乘客 + rails 运行

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-30
    • 2015-05-05
    相关资源
    最近更新 更多