2013-05-11 102 views
1

在Heroku上,我收到一个at=error code=H10 desc="App crashed" method=GET path=/favicon.ico路由错误。Heroku静态资产

在本地,我接收ActionController::RoutingError (No route matches [GET] "/favicon.ico"):路由错误。

我通过将config.serve_static_assets =设置为TRUE并运行rake assets:precompile来修复本地问题。

我一直无法解决Heroku上的问题。我推送了更新后的版本,并运行heroku run rake assets:precompile无济于事。

这使我疯狂......我和一个成功的部署之间有一个缩略图图标。任何建议将不胜感激!

完全Heroku的日志转储:

2013-05-11T17:08:14.869656+00:00 heroku[web.1]: State changed from crashed to starting 
2013-05-11T17:08:16.053848+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 44239` 
2013-05-11T17:08:18.803969+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) 
2013-05-11T17:08:18.804053+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) 
2013-05-11T17:08:20.523845+00:00 app[web.1]: => Booting WEBrick 
2013-05-11T17:08:20.524082+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers' 
2013-05-11T17:08:20.524082+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!' 
2013-05-11T17:08:20.523845+00:00 app[web.1]: => Call with -d to detach 
2013-05-11T17:08:20.523845+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on' 
2013-05-11T17:08:20.524353+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2013-05-11T17:08:20.523845+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:44239 
2013-05-11T17:08:20.524082+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `block in eager_load!' 
2013-05-11T17:08:20.524353+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing' 
2013-05-11T17:08:20.523845+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- Digest (LoadError) 
2013-05-11T17:08:20.524082+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers' 
.... 
2013-05-11T17:08:21.668731+00:00 heroku[web.1]: State changed from starting to crashed 

更新好家伙,这一切都缘于一个大写字母“d”的需要“消化” ...... downcased和一切正常。这是我一生中的几个小时,我永远不会回来。

+0

如果您把favicon.ico放在公共文件夹中怎么办? – juanpastas 2013-05-11 15:06:33

+0

这是在我的公共文件夹 – Dan 2013-05-11 15:08:31

回答

1

当您设置时会发生什么 - config.serve_static_assets = false并尝试做bundle exec rake assets:precompile RAILS_ENV=production?更多的是以下config.assets.compile设置为true

另一个笔记,我注意到你把favicon放在你的公共目录。我能够在我的layouts/application.html.erb

<!DOCTYPE html> 
<html> 
    <head> 
     <title><%= home_title %></title> 
     <%= stylesheet_link_tag "application" %> 
     <%= javascript_include_tag "application" %> 
     <%= csrf_meta_tag %> 
     <link rel="icon" href="<%= image_path 'icon.ico' %>" type="image/ico" /> 
     <link rel="shortcut icon" href="<%= image_path 'icon.ico' %>" type="image/ico" /> 
    </head> 

做以下设置我的图标你会发现,我的icon.ico。我的icon.ico位于我的app/assets/images目录中。

+0

没有喜欢设置为假和做耙子。 config.assets.compile设置为FALSE。我复制/粘贴你的HTML图标链接,并将文件移动到应用程序/资产/图像......没有快乐。 – Dan 2013-05-11 16:19:35

+0

@DanShev你刚才说你设置config.assets.compile设置为FALSE,当你刚才说你config.serve_static_assets = TRUE。我想你可能只是把错误的东西设置为假。默认情况下你的'config.assets.compile'应该设置为'true'。要清除我的'环境/ production.rb'的东西看起来像下面这样,应该是你的。 https://gist.github.com/anonymous/5560804。然后运行'bundle exec rake assets:预编译RAILS_ENV = production',并且还包含我的'html'。如果它给你一个错误粘贴在这里 – David 2013-05-11 17:56:47