ActionView :: Template :: Error(application.css未预编译)Rails

时间:2013-09-04 14:20:35

标签: ruby-on-rails ruby ubuntu passenger

我的生产服务器位于下方:

Started GET "/" for 101.160.190.206 at 2013-09-05 00:11:28 +1000
Processing by HomeController#index as HTML
  Rendered home/index.html.erb within layouts/application (0.5ms)
Completed 500 Internal Server Error in 2ms

ActionView::Template::Error (application.css isn't precompiled):
    4:     <meta name="viewport" content="width=device-width, initial-scale=1.0">
    5:     <title><%= content_for?(:title) ? yield(:title) : "Tools" %></title>
    6:     <meta name="description" content="<%= content_for?(:description) ? yield(:description) : "Tools" %>">
    7:     <%= stylesheet_link_tag "application", :media => "all" %>
    8:     <%= javascript_include_tag "application" %>
    9:     <%= csrf_meta_tags %>
    10:     <%= yield(:head) %>
  app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__153052184121312410_16560580'

我运行了rake assets:precompile,它似乎正确编译,因为我可以在资产文件中看到,但我仍然得到

We're sorry, but something went wrong.

错误。

我不确定它出了什么问题......

1 个答案:

答案 0 :(得分:1)

如果您没有修改任何内容application.css默认情况下应该包含在资产中,请尝试运行:

RAILS_ENV=production rake assets:precompile

而不是

rake assets:precompile

采用默认环境{默认development。至少那是几个星期前我遇到过的“问题”,所以也许在这种情况下也是如此。