Rails / Heroku问题

时间:2014-08-02 03:14:29

标签: ruby-on-rails heroku

我在Heroku上运行我的应用程序时遇到了麻烦。该应用程序在本地工作正常,并在我推动时没有错误。

我有点像菜鸟但这里是日志......我到底做错了什么?我肯定会做一些事情;)

谢谢!

2014-08-02T02:56:42.476683+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13:in `run'
2014-08-02T02:56:42.476676+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2014-08-02T02:56:42.476694+00:00 app[web.1]:    script/rails:6:in `require'
2014-08-02T02:56:42.476678+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2014-08-02T02:56:42.476687+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
2014-08-02T02:56:42.476686+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
2014-08-02T02:56:42.476692+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
2014-08-02T02:56:42.476724+00:00 app[web.1]: [2014-08-02 02:56:42] INFO  WEBrick::HTTPServer#start done.
2014-08-02T02:56:42.476702+00:00 app[web.1]: [2014-08-02 02:56:42] INFO  going to shutdown ...
2014-08-02T02:56:42.476691+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
2014-08-02T02:56:45.569017+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
 to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2014-08-02T02:56:45.568550
+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2014-08-02T02:56:46.545364+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:33203
2014-08-02T02:56:46.545366+00:00 app[web.1]: => Call with -d to detach
2014-08-02T02:56:46.545359+00:00 app[web.1]: => Booting WEBrick
2014-08-02T02:56:46.545368+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-08-02T02:56:46.545369+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2014-08-02T02:56:46.732149+00:00 app[web.1]: [2014-08-02 02:56:46] INFO  WEBrick 1.3.1
2014-08-02T02:56:46.732161+00:00 app[web.1]: [2014-08-02 02:56:46] INFO  ruby 2.0.0 (2014-05-08) [x86_64-linux]
2014-08-02T02:56:46.732729+00:00 app[web.1]: [2014-08-02 02:56:46] INFO  WEBrick::HTTPServer#start: pid=2 port=33203
2014-08-02T02:56:43.886636+00:00 heroku[web.1]: Process exited with status 143
2014-08-02T02:56:42.010285+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-02T02:56:47.056544+00:00 heroku[web.1]: State changed from starting to up
2014-08-02T02:56:42.970420+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 33203`
2014-08-02T03:00:05.358113+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by barry.lachapelle@gmail.com
2014-08-02T03:00:09.590408+00:00 heroku[run.9409]: State changed from starting to up
2014-08-02T03:00:13.162415+00:00 heroku[run.9409]: State changed from up to complete
2014-08-02T03:00:09.290473+00:00 heroku[run.9409]: Awaiting client
2014-08-02T03:00:13.152932+00:00 heroku[run.9409]: Process exited with status 0
2014-08-02T03:00:09.342086+00:00 heroku[run.9409]: Starting process with command `bundle exec rake db:migrate`
2014-08-02T03:00:21.764691+00:00 app[web.1]: Started GET "/" for 106.147.253.226 at 2014-08-02 03:00:21 +0000
2014-08-02T03:00:22.034004+00:00 heroku[router]: at=info method=GET path="/" host=ruffbooks.herokuapp.com request_id=dc981a56-9021-454e-930f-e6a3f3715fbd fwd="106.147.253.226" dyno=web.1 connect=1ms service=279ms status=500 bytes=758
2014-08-02T03:00:22.016420+00:00 app[web.1]: Processing by StaticPagesController#index as HTML
2014-08-02T03:00:22.028108+00:00 app[web.1]:   Rendered static_pages/index.html.erb within layouts/application (1.7ms)
2014-08-02T03:00:22.029621+00:00 app[web.1]: 
2014-08-02T03:00:22.029623+00:00 app[web.1]: ActionView::Template::Error (defaults.js isn't precompiled):
2014-08-02T03:00:22.029625+00:00 app[web.1]:     3:   <head>
2014-08-02T03:00:22.029626+00:00 app[web.1]:     4:     <title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
2014-08-02T03:00:22.029627+00:00 app[web.1]:     5:     <%= stylesheet_link_tag "application" %>
2014-08-02T03:00:22.029629+00:00 app[web.1]:     6:     <%= javascript_include_tag :defaults %>
2014-08-02T03:00:22.029630+00:00 app[web.1]:     7:     <%= csrf_meta_tag %>
2014-08-02T03:00:22.029634+00:00 app[web.1]:   app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__347943086722083126_69894744358040'
2014-08-02T03:00:22.028117+00:00 app[web.1]: Completed 500 Internal Server Error in 11ms
2014-08-02T03:00:22.029632+00:00 app[web.1]:     8:     <%= yield(:head) %>
2014-08-02T03:00:22.029635+00:00 app[web.1]: 
2014-08-02T03:00:22.029637+00:00 app[web.1]: 
2014-08-02T03:00:22.029633+00:00 app[web.1]:     9:   </head>
2014-08-02T03:00:22.872918+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=ruffbooks.herokuapp.com request_id=06611019-6bda-4c8c-b6a2-6cfc4ce1d2fa fwd="106.147.253.226" dyno=web.1 connect=1ms service=7ms status=200 bytes=748
2014-08-02T03:03:57+00:00 heroku[slug-compiler]: Slug compilation started
2014-08-02T03:04:09+00:00 heroku[slug-compiler]: Slug compilation finished
2014-08-02T03:04:09.949182+00:00 heroku[web.1]: State changed from up to starting
2014-08-02T03:04:09.852212+00:00 heroku[api]: Deploy 1d124f1 by barry.lachapelle@gmail.com
2014-08-02T03:04:09.852373+00:00 heroku[api]: Release v28 created by barry.lachapelle@gmail.com
2014-08-02T03:04:13.359256+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13:in `run'
2014-08-02T03:04:13.359228+00:00 app[web.1]: [2014-08-02 03:04:13] FATAL SignalException: SIGTERM
2014-08-02T03:04:13.359238+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2014-08-02T03:04:13.359241+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2014
-08-02T03:04:13.359243+00:00 app[web.1]:        /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2014-08-02T03:04:13.359259+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
2014-08-02T03:04:13.359261+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
2014-08-02T03:04:13.359240+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2014-08-02T03:04:13.359266+00:00 app[web.1]:    script/rails:6:in `require'
2014-08-02T03:04:13.359264+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
2014-08-02T03:04:13.359258+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
2014-08-02T03:04:13.359268+00:00 app[web.1]:    script/rails:6:in `<main>'
2014-08-02T03:04:13.359263+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
2014-08-02T03:04:13.359453+00:00 app[web.1]: [2014-08-02 03:04:13] INFO  going to shutdown ...
2014-08-02T03:04:13.359573+00:00 app[web.1]: [2014-08-02 03:04:13] INFO  WEBrick::HTTPServer#start done.
2014-08-02T03:04:13.359684+00:00 app[web.1]: Exiting
2014-08-02T03:04:14.853313+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
log.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2014-08-02T03:04:14.852857+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
 to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2014-08-02T03:04:15.736918+00:00 app[web.1]: => Call with -d to detach
2014-08-02T03:04:15.736904+00:00 app[web.1]: => Booting WEBrick
2014-08-02T03:04:15.736921+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2014-08-02T03:04:15.812883+00:00 app[web.1]: [2014-08-02 03:04:15] INFO  ruby 2.0.0 (2014-05-08) [x86_64-linux]
2014-08-02T03:04:15.736909+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:29602
2014-08-02T03:04:15.812869+00:00 app[web.1]: [2014-08-02 03:04:15] INFO  WEBrick 1.3.1
2014-08-02T03:04:15.813293+00:00 app[web.1]: [2014-08-02 03:04:15] INFO  WEBrick::HTTPServer#start: pid=2 port=29602
2014-08-02T03:04:15.736920+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-08-02T03:04:16.188320+00:00 heroku[web.1]: State changed from starting to up
2014-08-02T03:04:12.761970+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-08-02T03:04:14.640636+00:00 heroku[web.1]: Process exited with status 143
2014-08-02T03:04:12.705585+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 29602`
2014-08-02T03:04:22.615561+00:00 heroku[router]: at=info method=GET path="/" host=ruffbooks.herokuapp.com request_id=81868db3-a7e9-4d85-ac67-6ba8f1424167 fwd="106.147.253.226" dyno=web.1 connect=0ms service=104ms status=500 bytes=758
2014-08-02T03:04:22.611352+00:00 app[web.1]:     4:     <title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
2014-08-02T03:04:22.517499+00:00 app[web.1]: Started GET "/" for 106.147.253.226 at 2014-08-02 03:04:22 +0000
2014-08-02T03:04:22.611354+00:00 app[web.1]:     5:     <%= stylesheet_link_tag "application" %>
2014-08-02T03:04:22.611357+00:00 app[web.1]:     7:     <%= csrf_meta_tag %>
2014-08-02T03:04:22.611355+00:00 app[web.1]:     6:     <%= javascript_include_tag :defaults %>
2014-08-02T03:04:22.611346+00:00 app[web.1]: 
2014-08-02T03:04:22.611359+00:00 app[web.1]:     8:     <%= yield(:head) %>
2014-08-02T03:04:22.605983+00:00 app[web.1]:   Rendered static_pages/index.html.erb within layouts/application (1.7ms)
2014-08-02T03:04:22.611363+00:00 app[web.1]: 
2014-08-02T03:04:22.611360+00:00 app[web.1]:     9:   </head>
2014-08-02T03:04:22.611349+00:00 app[web.1]: ActionView::Template::Error (defaults.js isn't precompiled):
2014-08-02T03:04:22.611362+00:00 app[web.1]:   app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___3942217403030960468_70065509394080'
2014-08-02T03:04:22.611351+00:00 app[web.1]:     3:   <head>
2014-08-02T03:04:22.611365+00:00 app[web.1]: 
2014-08-02T03:04:22.598270+00:00 app[web.1]: Processing by StaticPagesController#index as HTML
2014-08-02T03:04:22.609526+00:00 app[web.1]: Completed 500 Internal Server Error in 11ms
2014-08-02T03:04:23.455514+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=ruffbooks.herokuapp.com request_id=f5d35eda-4dbd-4b4b-9954-27daea69e02c fwd="106.147.253.226" dyno=web.1 connect=1ms service=6ms status=200 bytes=748

3 个答案:

答案 0 :(得分:4)

在索引的第5行使用<%= javascript_include_tag "application" %>

答案 1 :(得分:2)

错误

为了向您提供有关在Heroku上运行应用程序的更多信息,您将遇到两种类型的错误:

<强>的Heroku

enter image description here

<强>滑轨

enter image description here

当您尝试加载Heroku应用程序(http://***.herokuapp.com)时会显示这些错误,并且解码起来相对简单。

  
      由于您自己的代码而导致
  • Rails 错误(通常您会遇到语法错误)。
  •   
  • Heroku 错误是由于您设置Heroku环境(IE平台错误)的原因而发生的错误
  •   

不同之处在于,如果您有 Rails 错误,那么您的应用程序在Heroku上运行正常 - 它只有很多内部问题,可能与您的语法有关。如果您看到Heroku错误,它实际上意味着您没有正确设置Heroku的平台(通常没有db),这意味着您必须使用Heroku进行排序。


<强>日志

您提到的问题是Rails问题,因为您可以在日志中看到错误可能是什么的详细信息。一个重要的注意事项是 Heroku 错误通常不会在您的日志中报告任何内容(但这是另一个故事)

我强烈建议您使用LogEntries add-on

enter image description here

安装此软件,然后使用后端的“实时”功能,可以更好地消化您收到的错误。至少它帮助了我们

-

阅读日志本身就是一门艺术。通常,您将寻找特定的“错误”消息 - 但这样做可能非常困难。我阅读你的日志的方式如下:

浏览完附件后,我找到了以下一行:

ActionView::Template::Error (defaults.js isn't precompiled):

应该是错误(尽管它可能是另一个错误的一部分)。它说明您的defaults.js文件夹中没有app/assets/javascripts/; Jade McGough正确指出的意思是你需要引用“应用程序”JS文件而不是

答案 2 :(得分:0)

请用第5行替换以下代码:

并运行&#34; heroku运行rake资产:预编译&#34; 项目路径上的此命令