2012-02-03 93 views
0

下面的代碼:在Heroku上部署Hello World Sinatra應用程序問題。

# helloworld.rb 

require 'sinatra' 

get '/' do 
'Hello world! Welcome to the root!' 
end 

,當我部署到Heroku的我得到這個在我的日誌:

2012-02-03T23:18:46+00:00 heroku[web.1]: State changed from crashed to created 
2012-02-03T23:18:46+00:00 heroku[web.1]: State changed from created to starting 
2012-02-03T23:18:47+00:00 heroku[slugc]: Slug compilation finished 
2012-02-03T23:18:48+00:00 heroku[web.1]: Starting process with command `thin -p 17403 -e production -R /home/heroku_rack/heroku.ru start` 
2012-02-03T23:18:49+00:00 app[web.1]: <internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- helloworld (LoadError) 
2012-02-03T23:18:49+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2012-02-03T23:18:49+00:00 app[web.1]: from config.ru:1:in `block (3 levels) in <main>' 
2012-02-03T23:18:49+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `eval' 
2012-02-03T23:18:49+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `block (3 levels) in <main>' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:63:in `new' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:63:in `map' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize' 
2012-02-03T23:18:49+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:18:in `block (2 levels) in <main>' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval' 
2012-02-03T23:18:49+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `new' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize' 
2012-02-03T23:18:49+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `block in <main>' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize' 
2012-02-03T23:18:49+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `new' 
2012-02-03T23:18:49+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `<main>' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `eval' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:65:in `start' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `load' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:175:in `load_rackup_config' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:143:in `run!' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:177:in `run_command' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/bin/thin:6:in `<top (required)>' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `load' 
2012-02-03T23:18:49+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `<main>' 
2012-02-03T23:18:50+00:00 heroku[web.1]: State changed from starting to crashed 
2012-02-03T23:18:51+00:00 heroku[web.1]: Process exited 
2012-02-03T23:18:57+00:00 heroku[router]: Error H10 (App crashed) -> GET alterra.heroku.com/ dyno= queue= wait= service= status=503 bytes= 
2012-02-03T23:18:57+00:00 heroku[nginx]: 129.89.10.150 - - [03/Feb/2012:23:18:57 +0000] "GET/HTTP/1.1" 503 607 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11" alterra.heroku.com 

我完全新的這一點,所以我認爲我做錯了什麼或忘記包括一些東西。我剛剛得到H10應用程序崩潰錯誤和應用程序錯誤頁面。

+0

有關您所期望的內容,您嘗試過的更多細節等可幫助潛在的答疑者 – 2012-02-04 19:32:34

回答

0

在你config.ru您需要更改

require 'helloworld' 

require './helloworld' 

這是在紅寶石1.9.2,在當前目錄中不再負載路徑上進行了更改。如果這在你的本地機器上工作,那麼你可以使用Ruby 1.8.7。如果是這種情況,那麼值得升級到1.9.2。

+0

真棒,謝謝!我也沒有Gemfile。我在新款MacBook Pro上運行1.9.2。當我在我的機器上運行Sinatra時,似乎並不關心我是否沒有Gemfile或config.ru文件。很多這對我來說都是新的。再次感謝! – 2012-02-04 02:14:33

+0

嗯,好的,所以你用'ruby helloworld.rb'在本地運行。如果你想在本地測試你的'config.ru',你可以簡單地鍵入'rackup',或者如果你已經安裝了Thin,'thin start',這是你在Heroku上可能使用的。 – matt 2012-02-04 04:09:26

相關問題