gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 05:04:26 25 4
gpt4 key购买 nike

在尝试开始领类之后,我得到了这个错误(请注意,尽管它似乎确实在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。 IE。您尚未在本地定义RACK_ENV。
您可以做的是在本地目录中创建一个 .env文件,例如

RACK_ENV=development

PORT=3000


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

关于ruby-on-rails - 工头启动错误(server.rb :33,缺少参数...),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9765860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com