0

我试图将应用程序部署到 Heroku,但是当我推送我的 config.ru 文件时出现错误。

关注 Heroku 的日志:

2013-01-16T21:04:14+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 29160`
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `<main>'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/server.rb:137:in `start'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/config.ru:in `new'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/server.rb:304:in `wrapped_app'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/bin/rackup:4:in `<top (required)>'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:40:in `parse_file'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/server.rb:200:in `app'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/config.ru:in `<main>'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:40:in `eval'
2013-01-16T21:04:16+00:00 app[web.1]: /app/config.ru:1:in `block in <main>': undefined method `require' for #<Rack::Builder:0x0000000281d6a0 @run=nil, @map=nil, @use=[]> (NoMethodError)
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.4/lib/rack/server.rb:254:in `start'
2013-01-16T21:04:16+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `load'
2013-01-16T21:04:17+00:00 heroku[web.1]: State changed from starting to crashed
2013-01-16T21:04:17+00:00 heroku[web.1]: Process exited with status 1
2013-01-16T21:04:18+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=mazzocato.herokuapp.com fwd=201.95.41.116 dyno= queue= wait= connect= service= status=503 bytes=
2013-01-16T21:04:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=mazzocato.herokuapp.com fwd=201.95.41.116 dyno= queue= wait= connect= service= status=503 bytes=
2013-01-16T21:04:20+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=mazzocato.herokuapp.com fwd=201.95.41.116 dyno= queue= wait= connect= service= status=503 bytes=
2013-01-16T21:04:37+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=mazzocato.herokuapp.com fwd=201.95.41.116 dyno= queue= wait= connect= service= status=503 bytes=
2013-01-16T21:04:06+00:00 heroku[web.1]: Unidling

按照我的 config.ru 文件:

require './app'
run Sinatra::Application

我的主要文件是app.rb

有什么帮助吗?

4

2 回答 2

0

(试图将此作为评论推送......格式不正确)

仅从日志中很难知道。你的 app.rb 文件里有什么?通常人们会这样做:

require 'rubygems'
require 'sinatra' # or Bundle.require
require 'app/mystuff'

run Sinatra::Application

但是很难知道您是否需要 sinatra 以及“app.rb”文件中的所有其他内容。

于 2013-01-18T08:51:28.110 回答
0

登录 heroku,然后将 dynos 的数量缩放为 0。保存,然后重新缩放。发生在我身上几次,每次都有效。

于 2013-07-12T17:57:44.377 回答