Heroku上的资源预编译错误
问题描述:
我是RoR的新手,试图部署到Heroku,但它让我疯狂!这是我的日志:Heroku上的资源预编译错误
2012-04-21T19:32:27+00:00 app[web.1]:
2012-04-21T19:32:27+00:00 app[web.1]:
2012-04-21T19:32:27+00:00 app[web.1]: Started GET "/" for 89.240.212.20 at 2012-04-21 19:32:27 +0000
2012-04-21T19:32:27+00:00 app[web.1]: Processing by StoreController#index as HTML
2012-04-21T19:32:27+00:00 app[web.1]: Rendered store/index.html.erb within layouts/application (86.1ms)
2012-04-21T19:32:27+00:00 app[web.1]: Completed 500 Internal Server Error in 266ms
2012-04-21T19:32:27+00:00 app[web.1]:
2012-04-21T19:32:27+00:00 app[web.1]: ActionView::Template::Error (scaffold.css isn't precompiled):
2012-04-21T19:32:27+00:00 app[web.1]: 4: <head>
2012-04-21T19:32:27+00:00 app[web.1]: 5: <title>Pragprog Books Online Store</title>
2012-04-21T19:32:27+00:00 app[web.1]: 6: <!-- START:stylesheet -->
2012-04-21T19:32:27+00:00 app[web.1]: 7: <%= stylesheet_link_tag "scaffold" %>
2012-04-21T19:32:27+00:00 app[web.1]: 8: <%= stylesheet_link_tag "depot", :media => "all" %><!-- <label id="code.slt"/> -->
2012-04-21T19:32:27+00:00 app[web.1]: 9: <!-- END:stylesheet -->
2012-04-21T19:32:27+00:00 app[web.1]: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__3129246563521504454_25831520'
2012-04-21T19:32:27+00:00 app[web.1]: 10: <%= javascript_include_tag :defaults %>
2012-04-21T19:32:27+00:00 app[web.1]:
2012-04-21T19:32:27+00:00 app[web.1]:
2012-04-21T19:32:27+00:00 heroku[router]: GET depotalghamdi.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=384ms status=500 bytes=643
2012-04-21T19:32:28+00:00 heroku[router]: GET depotalghamdi.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=10ms status=200 bytes=0
2012-04-21T19:32:28+00:00 heroku[web.1]: Error R12 (Exit timeout) -> Process failed to exit within 10 seconds of SIGTERM
2012-04-21T19:32:28+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-04-21T19:32:29+00:00 heroku[web.1]: Process exited with status 137
2012-04-21T19:33:09+00:00 app[web.1]:
2012-04-21T19:33:09+00:00 app[web.1]:
2012-04-21T19:33:09+00:00 app[web.1]: Processing by StoreController#index as HTML
2012-04-21T19:33:09+00:00 app[web.1]: Started GET "/" for 89.240.212.20 at 2012-04-21 19:33:09 +0000
2012-04-21T19:33:09+00:00 app[web.1]: Rendered store/index.html.erb within layouts/application (1.6ms)
2012-04-21T19:33:09+00:00 app[web.1]: Completed 500 Internal Server Error in 7ms
2012-04-21T19:33:09+00:00 app[web.1]:
2012-04-21T19:33:09+00:00 app[web.1]: ActionView::Template::Error (scaffold.css isn't precompiled):
2012-04-21T19:33:09+00:00 app[web.1]: 4: <head>
2012-04-21T19:33:09+00:00 app[web.1]: 5: <title>Pragprog Books Online Store</title>
2012-04-21T19:33:09+00:00 app[web.1]: 8: <%= stylesheet_link_tag "depot", :media => "all" %><!-- <label id="code.slt"/> -->
2012-04-21T19:33:09+00:00 app[web.1]: 6: <!-- START:stylesheet -->
2012-04-21T19:33:09+00:00 app[web.1]: 7: <%= stylesheet_link_tag "scaffold" %>
2012-04-21T19:33:09+00:00 app[web.1]: 9: <!-- END:stylesheet -->
2012-04-21T19:33:09+00:00 app[web.1]: 10: <%= javascript_include_tag :defaults %>
2012-04-21T19:33:09+00:00 app[web.1]: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__3129246563521504454_25831520'
2012-04-21T19:33:09+00:00 app[web.1]:
2012-04-21T19:33:09+00:00 app[web.1]:
2012-04-21T19:33:09+00:00 heroku[router]: GET depotalghamdi.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=19ms status=500 bytes=643
2012-04-21T19:33:10+00:00 heroku[router]: GET depotalghamdi.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=34ms status=304 bytes=0
2012-04-21T19:33:11+00:00 heroku[router]: GET depotalghamdi.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=31ms status=500 bytes=643
2012-04-21T19:33:11+00:00 app[web.1]:
2012-04-21T19:33:11+00:00 app[web.1]:
2012-04-21T19:33:11+00:00 app[web.1]: Processing by StoreController#index as HTML
2012-04-21T19:33:11+00:00 app[web.1]: Started GET "/" for 89.240.212.20 at 2012-04-21 19:33:11 +0000
2012-04-21T19:33:11+00:00 app[web.1]: Completed 500 Internal Server Error in 12ms
2012-04-21T19:33:11+00:00 app[web.1]:
2012-04-21T19:33:11+00:00 app[web.1]: ActionView::Template::Error (scaffold.css isn't precompiled):
2012-04-21T19:33:11+00:00 app[web.1]: 5: <title>Pragprog Books Online Store</title>
2012-04-21T19:33:11+00:00 app[web.1]: 4: <head>
2012-04-21T19:33:11+00:00 app[web.1]: Rendered store/index.html.erb within layouts/application (1.4ms)
2012-04-21T19:33:11+00:00 app[web.1]: 7: <%= stylesheet_link_tag "scaffold" %>
2012-04-21T19:33:11+00:00 app[web.1]:
2012-04-21T19:33:11+00:00 app[web.1]: 8: <%= stylesheet_link_tag "depot", :media => "all" %><!-- <label id="code.slt"/> -->
2012-04-21T19:33:11+00:00 app[web.1]: 9: <!-- END:stylesheet -->
2012-04-21T19:33:11+00:00 app[web.1]: 10: <%= javascript_include_tag :defaults %>
2012-04-21T19:33:11+00:00 app[web.1]: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__3129246563521504454_25831520'
2012-04-21T19:33:11+00:00 app[web.1]:
2012-04-21T19:33:11+00:00 app[web.1]: 6: <!-- START:stylesheet -->
2012-04-21T19:33:13+00:00 app[web.1]:
2012-04-21T19:33:13+00:00 app[web.1]:
2012-04-21T19:33:13+00:00 app[web.1]: Processing by StoreController#index as HTML
2012-04-21T19:33:13+00:00 app[web.1]: Started GET "/" for 89.240.212.20 at 2012-04-21 19:33:13 +0000
2012-04-21T19:33:13+00:00 app[web.1]: Rendered store/index.html.erb within layouts/application (14.5ms)
2012-04-21T19:33:13+00:00 app[web.1]: Completed 500 Internal Server Error in 66ms
2012-04-21T19:33:13+00:00 app[web.1]: ActionView::Template::Error (scaffold.css isn't precompiled):
2012-04-21T19:33:13+00:00 app[web.1]: 4: <head>
2012-04-21T19:33:13+00:00 app[web.1]:
2012-04-21T19:33:13+00:00 app[web.1]: 5
: <title>Pragprog Books Online Store</title>
2012-04-21T19:33:13+00:00 app[web.1]: 6: <!-- START:stylesheet -->
2012-04-21T19:33:13+00:00 app[web.1]: 7: <%= stylesheet_link_tag "scaffold" %>
2012-04-21T19:33:13+00:00 app[web.1]: 8: <%= stylesheet_link_tag "depot", :media => "all" %><!-- <label id="code.slt"/> -->
2012-04-21T19:33:13+00:00 app[web.1]: 9: <!-- END:stylesheet -->
2012-04-21T19:33:13+00:00 app[web.1]: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__3129246563521504454_25831520'
2012-04-21T19:33:13+00:00 app[web.1]: 10: <%= javascript_include_tag :defaults %>
2012-04-21T19:33:13+00:00 app[web.1]:
2012-04-21T19:33:13+00:00 app[web.1]:
2012-04-21T19:33:13+00:00 heroku[router]: GET depotalghamdi.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=89ms status=500 bytes=643
2012-04-21T19:33:15+00:00 app[web.1]:
2012-04-21T19:33:15+00:00 app[web.1]:
2012-04-21T19:33:15+00:00 app[web.1]: Started GET "/" for 89.240.212.20 at 2012-04-21 19:33:15 +0000
2012-04-21T19:33:15+00:00 app[web.1]: Processing by StoreController#index as HTML
2012-04-21T19:33:15+00:00 app[web.1]: Rendered store/index.html.erb within layouts/application (1.4ms)
2012-04-21T19:33:15+00:00 app[web.1]: Completed 500 Internal Server Error in 20ms
2012-04-21T19:33:15+00:00 app[web.1]:
2012-04-21T19:33:15+00:00 app[web.1]: 4: <head>
2012-04-21T19:33:15+00:00 app[web.1]: 6: <!-- START:stylesheet -->
2012-04-21T19:33:15+00:00 app[web.1]: ActionView::Template::Error (scaffold.css isn't precompiled):
2012-04-21T19:33:15+00:00 app[web.1]: 7: <%= stylesheet_link_tag "scaffold" %>
2012-04-21T19:33:15+00:00 app[web.1]: 5: <title>Pragprog Books Online Store</title>
2012-04-21T19:33:15+00:00 app[web.1]: 9: <!-- END:stylesheet -->
2012-04-21T19:33:15+00:00 app[web.1]: 10: <%= javascript_include_tag :defaults %>
2012-04-21T19:33:15+00:00 app[web.1]: 8: <%= stylesheet_link_tag "depot", :media => "all" %><!-- <label id="code.slt"/> -->
2012-04-21T19:33:15+00:00 app[web.1]: app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__3129246563521504454_25831520'
2012-04-21T19:33:15+00:00 app[web.1]:
2012-04-21T19:33:15+00:00 heroku[router]: GET depotalghamdi.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=65ms status=500 bytes=643
2012-04-21T19:33:15+00:00 app[web.1]:
我什么都试过,我知道预编译所有的CSS & js文件,但仍然收到这个错误我甚至设置config.assets.precompile += ['*.js', '*.css']
,但仍然没有工作。 当我将config.serve_static_assets
变为true
一切正常,但你知道它有一些缺点! 任何线索?
答
它看起来像你试图直接加载你的scaffold css文件 - application.html.erb的第7行?我不熟悉你的基础教程,但通常你的stylesheet_link_tag
是application
本身是一个清单文件,让链轮知道需要编译。
在assets \ stylesheets目录中创建一个application.css
文件,它应该看起来像;
/*
*= require_self
*= require_tree
*/
您可以将现有的scaffold.css文件在地方作为require_tree将有链轮在文件中包含它的编译任务。
谢谢约翰,帮助。但是,我看到'js'文件尚未编译!在我的日志中'ActionView :: Template :: Error(defaults.js不是预编译):'即使我在我的'application.html.erb'中使用'' – Ansd 2012-04-22 00:33:18
同样适用于此 - 您使用application.js作为包含defaults.js的清单。清单是略有不同的JS - 更多详细信息在http://guides.rubyonrails.org/asset_pipeline.html#manifest-files-and-directives – 2012-04-22 07:35:20
你是辉煌:) – Ansd 2012-04-22 14:54:52