ActionView::Template::Error (application.css isn't precompiled) Rails

时光总嘲笑我的痴心妄想 提交于 2019-12-11 19:25:27

问题


I'm getting below in my production server:

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'

I ran rake assets:precompile and it seems to compile correctly as I can see in the assets file but I'm still getting

We're sorry, but something went wrong.

error.

I'm not sure where it went wrong...


回答1:


If you haven't modified anything application.css should be included by default into assets, so try running:

RAILS_ENV=production rake assets:precompile

instead of

rake assets:precompile

which takes default environment which is by default development. At least that was an 'issue' I've faced several weeks ago, so maybe it's same in that case.



来源:https://stackoverflow.com/questions/18616405/actionviewtemplateerror-application-css-isnt-precompiled-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!