我注意到當我部署我的sinatra應用程序時,heroku產生了一個神祕的錯誤。它工作正常,在當地,而事實上,它在Heroku上運行良好,以及 - 但這個錯誤出現在Heroku的日誌我每次部署(且僅在部署):將sinatra應用程序部署到heroku:bundler的神祕錯誤:未能加載命令:rackup
2017-04-26T08:52:25.579045+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.3.0/bin/rackup)
2017-04-26T08:52:25.579176+00:00 app[web.1]: RuntimeError: missing run or map statement
2017-04-26T08:52:25.579178+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/builder.rb:146:in `to_app'
2017-04-26T08:52:25.579179+00:00 app[web.1]: /app/config.ru:5:in `<main>'
2017-04-26T08:52:25.579180+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/builder.rb:49:in `eval'
2017-04-26T08:52:25.579180+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/builder.rb:49:in `new_from_string'
2017-04-26T08:52:25.579181+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/builder.rb:40:in `parse_file'
2017-04-26T08:52:25.579182+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/server.rb:299:in `build_app_and_options_from_config'
2017-04-26T08:52:25.579183+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/server.rb:208:in `app'
2017-04-26T08:52:25.579184+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/server.rb:336:in `wrapped_app'
2017-04-26T08:52:25.579184+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/server.rb:272:in `start'
2017-04-26T08:52:25.579185+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/server.rb:147:in `start'
2017-04-26T08:52:25.579186+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/bin/rackup:4:in `<top (required)>'
2017-04-26T08:52:25.579187+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/bin/rackup:23:in `load'
2017-04-26T08:52:25.579215+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/bin/rackup:23:in `<top (required)>'
2017-04-26T08:52:25.724981+00:00 heroku[web.1]: Process exited with status 1
2017-04-26T08:52:26.928566+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 56963`
2017-04-26T08:52:29.278571+00:00 app[web.1]: [2017-04-26 08:52:29] INFO WEBrick 1.3.1
2017-04-26T08:52:29.278590+00:00 app[web.1]: [2017-04-26 08:52:29] INFO ruby 2.3.1 (2016-04-26) [x86_64-linux]
2017-04-26T08:52:29.278909+00:00 app[web.1]: == Sinatra (v1.4.8) has taken the stage on 56963 for production with backup from WEBrick
2017-04-26T08:52:29.279274+00:00 app[web.1]: [2017-04-26 08:52:29] INFO WEBrick::HTTPServer#start: pid=4 port=56963
2017-04-26T08:52:29.825875+00:00 heroku[web.1]: State changed from starting to up
其他職位提出,這可能由於config.ru
中的錯誤。煤礦只包含:
require './lib/app'
SinatraApp.run!
這裏是我的Procfile
:
web: bundle exec rackup config.ru -p $PORT
的heroku deploy log is here,在情況下,它是有幫助的。正如我所說,該應用程序似乎工作正常(您可以看到它在上述成績單結束時成功啓動),但我無法理解在每個部署中導致此錯誤的原因。
謝謝。
你確定你提供正確的'config.ru'引發的錯誤?回溯表明它至少有5行:'/app/config.ru:5:in',並且您包含的源只有兩行。 –
好點。我也注意到了這一點。在我的項目中只有一個'config.ru'(我重複檢查)。 heroku是否正在部署某種默認的'config.ru'?在heroku文檔中我找不到任何這方面的證據,當我連接到我的dyno並檢查文件時,它沒有任何變化。 –