Heroku在Middleman网站上的应用错误

时间:2015-04-14 00:41:14

标签: ruby heroku static middleman

我一直关注Thoughtbot Middleman guide。我推到Heroku时曾经工作得很好,但过去两周它停止了工作。

Heroku日志:

2015-04-14T00:28:52.265232+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 33769`
2015-04-14T00:28:54.785358+00:00 app[web.1]: /app/config.ru:4:in `block in <main>': undefined method `server' for Middleman:Module (NoMethodError)
2015-04-14T00:28:54.785381+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
2015-04-14T00:28:54.785384+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
2015-04-14T00:28:54.785389+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
2015-04-14T00:28:54.785390+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
2015-04-14T00:28:54.785385+00:00 app[web.1]: 	from /app/config.ru:in `new'
2015-04-14T00:28:54.785387+00:00 app[web.1]: 	from /app/config.ru:in `<main>'
2015-04-14T00:28:54.785405+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/bin/rackup:23:in `load'
2015-04-14T00:28:54.785392+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
2015-04-14T00:28:54.785403+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/bin/rackup:4:in `<top (required)>'
2015-04-14T00:28:54.785399+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
2015-04-14T00:28:54.785400+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:272:in `start'
2015-04-14T00:28:54.785402+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:147:in `start'
2015-04-14T00:28:54.785408+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/bin/rackup:23:in `<main>'
2015-04-14T00:28:54.785394+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
2015-04-14T00:28:54.785397+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
2015-04-14T00:28:55.506629+00:00 heroku[web.1]: State changed from crashed to starting
2015-04-14T00:28:55.505287+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-14T00:28:55.494009+00:00 heroku[web.1]: Process exited with status 1
2015-04-14T00:28:59.625355+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 30791`
2015-04-14T00:29:02.364349+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
2015-04-14T00:29:02.364325+00:00 app[web.1]: /app/config.ru:4:in `block in <main>': undefined method `server' for Middleman:Module (NoMethodError)
2015-04-14T00:29:02.364362+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
2015-04-14T00:29:02.364358+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
2015-04-14T00:29:02.364356+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
2015-04-14T00:29:02.364347+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
2015-04-14T00:29:02.364352+00:00 app[web.1]: 	from /app/config.ru:in `<main>'
2015-04-14T00:29:02.364351+00:00 app[web.1]: 	from /app/config.ru:in `new'
2015-04-14T00:29:02.364372+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
2015-04-14T00:29:02.364376+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:272:in `start'
2015-04-14T00:29:02.364410+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:147:in `start'
2015-04-14T00:29:02.364413+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/bin/rackup:23:in `load'
2015-04-14T00:29:02.364369+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
2015-04-14T00:29:02.364412+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/bin/rackup:4:in `<top (required)>'
2015-04-14T00:29:02.364417+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/bin/rackup:23:in `<main>'
2015-04-14T00:29:02.364365+00:00 app[web.1]: 	from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
2015-04-14T00:29:03.495350+00:00 heroku[web.1]: Process exited with status 1
2015-04-14T00:29:03.512947+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-14T00:29:04.147197+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=afternoon-caverns-1614.herokuapp.com request_id=d52f8ceb-4076-4371-b2b4-daf621689b2b fwd="198.2.47.2" dyno= connect= service= status=503 bytes=
2015-04-14T00:29:04.920600+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=afternoon-caverns-1614.herokuapp.com request_id=edc85d48-13ef-4b60-b758-351e8d465a75 fwd="198.2.47.2" dyno= connect= service= status=503 bytes=
WARNING: Toolbelt v3.31.3 update available.

最后两行显示H10错误,我似乎无法弄清楚。

2 个答案:

答案 0 :(得分:1)

Middleman的机架服务器支持目前在版本3.3.9之后被破坏。

现在的解决方法是使用版本3.3.8或之前的版本。

您可能需要在Gemfile中指定版本:

gem 'middleman', '3.3.8'

P.S。我为此在Github上打开了an issue

答案 1 :(得分:1)

问题已经解决。问题是config.ru中的Middleman.server。删除它可以解决问题。拥有Rack就足够了。