错误Rails 4控制台登台或生产

时间:2016-02-22 01:50:13

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

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

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)

请帮助!!

4 个答案:

答案 0 :(得分:5)

运行此命令以production模式

运行rails服务器
rails s -e production

答案 1 :(得分:2)

猜测:

RAILS_ENV=production rails s production

到:

RAILS_ENV=production rails s

答案 2 :(得分:0)

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

答案 3 :(得分:0)

当然这是你的命令问题

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