我遵循rails教程chapter7,一切都很順利,直到我將代碼推送到heroku並按下「heroku open」命令時。然後嘗試運行命令$ heroku logs
,得到了以下錯誤消息
2013-05-31T16:00:17.416309+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (0.5ms)
2013-05-31T16:00:17.431511+00:00 app[web.1]:
2013-05-31T16:00:17.431511+00:00 app[web.1]: 3: <head>
2013-05-31T16:00:17.429902+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms
2013-05-31T16:00:17.431511+00:00 app[web.1]: ActionView::Template::Error (Invalid CSS after "5: ": expected "{", was "$grayMediumLigh..."
2013-05-31T16:00:17.431511+00:00 app[web.1]: (in /app/app/assets/stylesheets/application.css)):
2013-05-31T16:00:17.431511+00:00 app[web.1]: 2: <html>
2013-05-31T16:00:17.431761+00:00 app[web.1]:
2013-05-31T16:00:17.431511+00:00 app[web.1]: 4: <title><%= full_title(yield(:title)) %></title>
2013-05-31T16:00:17.431511+00:00 app[web.1]: 6: <%= javascript_include_tag "application" %>
2013-05-31T16:00:17.431511+00:00 app[web.1]: 5: <%= stylesheet_link_tag "application", media: "all" %>
2013-05-31T16:00:17.431511+00:00 app[web.1]: 7: <%= csrf_meta_tags %>
2013-05-31T16:00:17.431511+00:00 app[web.1]: 8: <%= render 'layouts/shim' %>
2013-05-31T16:00:17.431761+00:00 app[web.1]: app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___1044640585478715857_42045460'
2013-05-31T16:00:17.431761+00:00 app[web.1]:
2013-05-31T16:00:18.589737+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=shrouded-waters-7990.herokuapp.com fwd="106.147.82.192" dyno=web.1 connect=1ms service=4ms status=304 bytes=0
我的源文件如下:
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<% flash.each do |key, value| %>
<%= content_tag(:div, value, class: "alert alert-#{key}") %>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
</div>
</body>
</html>
$grayMediumLight
存在於文件custom.css.scss
文件。它太冗長,所以我只是粘貼部分如下:
custom.css.scss
@import "bootstrap";
/* mixins, variables, etc. */
$grayMediumLight: #eaeaea;
@mixin box_sizing {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* universal */
html {
overflow-y: scroll;
}
body {
padding-top: 60px;
}
.....
你有鏈接的教程?代碼看起來正確。 – Femaref
http://ruby.railstutorial.org/chapters/sign-up,這是鏈接。而且我也將我的代碼推送到https://github.com/ryuever/sample_app – ryu