ruby-on-rails – 工头启动错误(server.rb:33,缺少参数……)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 工头启动错误(server.rb:33,缺少参数……)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在尝试启动工头后,我得到了这个错误(请注意,它似乎确实在heroku上工作,所以我猜这是一个严格的本地问题):
hrn039:textthechange jon$foreman start
02:20:00 web.1     | started with pid 7363
02:20:01 web.1     | /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:33:in `parse!': missing argument: -e (OptionParser::MissingArgument)
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:280:in `parse_options'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:180:in `options'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:54:in `set_environment'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:42:in `initialize'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `new'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
02:20:01 web.1     |    from script/rails:6:in `require'
02:20:01 web.1     |    from script/rails:6:in `<main>'
02:20:01 web.1     | process terminated
02:20:01 system    | sending SIGTERM to all processes

Procfile只有一行为specified by heroku

web: bundle exec rails server thin -p $PORT -e $RACK_ENV

我的gemfile有

gem 'thin'

Google对此错误的帮助不大.

谢谢!

解决方法

这不是关于在Heroku上执行 – 看到关于执行Foreman的原始问题 – 这是本地执行.

您可以通过执行以下操作来复制错误

rails server thin -e

鉴于您的Procfile,这实际上是Foreman正在运行的:

web: bundle exec rails server thin -p $PORT -e $RACK_ENV

所以我猜你没有把参数传给-e.即.你还没有在本地定义RACK_ENV.

你可以做的是在你的本地目录中创建一个.env文件,例如

RACK_ENV=development

PORT=3000

在根据您的流程类型声明创建流程之前,Foreman将自动获取本地.env文件并适当地设置环境.

原文链接:/ruby/271161.html

猜你在找的Ruby相关文章