【问题标题】:Ruby on Rails 3.2 compiled assets are not workingRuby on Rails 3.2 编译的资产不起作用
【发布时间】:2012-02-01 23:33:47
【问题描述】:

这是 Rails 资产中的错误吗? 我看不出我做错了什么。你能帮忙吗? 我不想做按需编译...

错误:

Started GET "/" for 127.0.0.1 at 2012-02-02 01:25:44 +0200
Processing by StaticPagesController#home as HTML
  Rendered static_pages/home.html.erb within layouts/application (11.8ms)
  Rendered layouts/_stylesheets.html.erb (3.1ms)
Completed 500 Internal Server Error in 33ms

ActionView::Template::Error (blueprint/screen.css isn't precompiled):
    1: <!--[if lt IE 9]>
    2: <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    3: <![endif]-->
    4: <%= stylesheet_link_tag    'blueprint/screen', media: 'screen' %>
    5: <%= stylesheet_link_tag    'blueprint/print', media: 'print' %>
    6: <!--[if lt IE 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]-->
    7: <%= stylesheet_link_tag    "application", :media => "all" %>
  app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb___420254603692159600_23189320'
  app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___3529609308555441821_21997000'

来自 production.rb

config.serve_static_assets = true
...
config.assets.precompile += %w( blueprint/screen.css blueprint/print.css blueprint/ie.css )

来自 production.log

Compiled jquery.js  (1ms)  (pid 14042)
Compiled jquery_ujs.js  (0ms)  (pid 14042)
Compiled static_pages.js  (59ms)  (pid 14042)
Compiled users.js  (1ms)  (pid 14042)
Compiled application.js  (84ms)  (pid 14042)
Compiled layout.css  (14ms)  (pid 14042)
Compiled static_pages.css  (0ms)  (pid 14042)
Compiled users.css  (0ms)  (pid 14042)
Compiled application.css  (24ms)  (pid 14042)
Compiled blueprint/ie.css  (0ms)  (pid 14042)
Compiled blueprint/print.css  (0ms)  (pid 14042)
Compiled blueprint/screen.css  (0ms)  (pid 14042)

【问题讨论】:

  • Jup... 我也有类似的问题。你在用 mongodb 吗?
  • 我遇到了完全相同的问题,几乎要放弃了。我什至由我的一个专业的 Rails 开发人员朋友运行这个,他无能为力。这是我的帖子stackoverflow.com/questions/10177186/…

标签: asset-pipeline ruby-on-rails-3.2


【解决方案1】:

试试bundle exec rake assets:precompile 然后检查 public/assets 文件夹是否有所有必需的资产。

【讨论】:

  • 我也遇到了同样的问题,是的,我可以在本地预编译资产,而且它们显示得很好。查看我的帖子以了解问题的全部范围:stackoverflow.com/questions/10177186/…
猜你喜欢
  • 1970-01-01
  • 2011-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-30
  • 1970-01-01
  • 2012-03-26
相关资源
最近更新 更多