0

我正在使用 Ruby On Rails、Bootstrap 和 Spree 创建一个应用程序。我的本地主机上一切正常,但是当我推送到 Heroku 时,我收到一条错误消息“我们很抱歉,但出了点问题。” 当我将“/store”添加到加载正常的地址时,我可以访问 Heroku 上的商店区域,但主页加载时显示错误消息。当我运行 heroku 日志时,我看到:

Processing by PagesController#home as HTML
2013-04-19T16:03:19.156092+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (100.2ms)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled jquery.alerts/jquery.alerts.css  (145ms)  (pid 2)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled jquery.alerts/jquery.alerts.spree.css  (0ms)  (pid 2)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled responsive-tables.css  (0ms)  (pid 2)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled normalize.css  (0ms)  (pid 2)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled skeleton.css  (0ms)  (pid 2)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled jquery-ui.datepicker.css  (259ms)  (pid 2)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled jquery.powertip.css  (0ms)  (pid 2)
2013-04-19T16:03:19.156092+00:00 app[web.1]: Compiled select2.css  (2728ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled admin/spree_admin.css  (1552ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled admin/spree_core.css  (4771ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled admin/spree_promo.css  (1ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled admin/all.css  (4785ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled pages.css  (0ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled store/screen.css  (600ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled store/spree_core.css  (609ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled store/spree_promo.css  (11ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Compiled store/all.css  (631ms)  (pid 2)
2013-04-19T16:03:19.156538+00:00 app[web.1]: Completed 500 Internal Server Error in 5726ms
2013-04-19T16:03:19.149366+00:00 app[web.1]: 
2013-04-19T16:03:19.149366+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2013-04-19T16:03:19.149366+00:00 app[web.1]: Load path: /app
2013-04-19T16:03:19.149366+00:00 app[web.1]:     2: <html>
2013-04-19T16:03:19.149366+00:00 app[web.1]:     7:   <%= csrf_meta_tags %>
2013-04-19T16:03:19.149842+00:00 app[web.1]:     8: </head>
2013-04-19T16:03:19.149366+00:00 app[web.1]:     4:   <title>Sample App</title>
2013-04-19T16:03:19.149842+00:00 app[web.1]:   app/assets/stylesheets/styles.css.scss:5
2013-04-19T16:03:19.149842+00:00 app[web.1]:   app/views/layouts/application.html.erb:5:in `_2bef37236eb3fbbf2665a458326374e1'
2013-04-19T16:03:19.149366+00:00 app[web.1]:     5:   <%= stylesheet_link_tag    "application", :media => "all" %>
2013-04-19T16:03:19.149366+00:00 app[web.1]:     6:   <%= javascript_include_tag "application" %>
2013-04-19T16:03:19.149366+00:00 app[web.1]:   (in /app/app/assets/stylesheets/styles.css.scss)):
2013-04-19T16:03:19.149366+00:00 app[web.1]:     3: <head>
2013-04-19T16:03:19.157636+00:00 heroku[router]: at=info method=GET path=/ host=guarded-headland-2911.herokuapp.com fwd="98.154.183.5" dyno=web.1 connect=6ms service=6092ms status=500 bytes=643
2013-04-19T16:03:27.655609+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-04-19T16:03:27.655609+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-04-19T16:03:29.492003+00:00 heroku[web.1]: Process exited with status 137
2013-04-19T16:08:01.494500+00:00 app[web.1]: Started GET "/" for 98.154.183.5 at 2013-04-19 16:08:01 +0000
2013-04-19T16:08:01.526972+00:00 app[web.1]: 
2013-04-19T16:08:01.526972+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2013-04-19T16:08:01.526972+00:00 app[web.1]: Load path: /app
2013-04-19T16:08:01.526972+00:00 app[web.1]:   (in /app/app/assets/stylesheets/styles.css.scss)):
2013-04-19T16:08:01.526972+00:00 app[web.1]:     2: <html>
2013-04-19T16:08:01.526972+00:00 app[web.1]:     5:   <%= stylesheet_link_tag    "application", :media => "all" %>
2013-04-19T16:08:01.526972+00:00 app[web.1]:     7:   <%= csrf_meta_tags %>
2013-04-19T16:08:01.526972+00:00 app[web.1]:     6:   <%= javascript_include_tag "application" %>
2013-04-19T16:08:01.527299+00:00 app[web.1]: Completed 500 Internal Server Error in 20ms
2013-04-19T16:08:01.526972+00:00 app[web.1]:     3: <head>
2013-04-19T16:08:01.526972+00:00 app[web.1]:     4:   <title>Sample App</title>
2013-04-19T16:08:01.527299+00:00 app[web.1]: 
2013-04-19T16:08:01.527299+00:00 app[web.1]: 
2013-04-19T16:08:01.527299+00:00 app[web.1]:   app/assets/stylesheets/styles.css.scss:5
2013-04-19T16:08:01.527299+00:00 app[web.1]: Processing by PagesController#home as HTML
2013-04-19T16:08:01.527299+00:00 app[web.1]:     8: </head>
2013-04-19T16:08:01.527299+00:00 app[web.1]:   app/views/layouts/application.html.erb:5:in `_2be
f37236eb3fbbf2665a458326374e1'
2013-04-19T16:08:01.527299+00:00 app[web.1]:   Rendered pages/home.html.erb within layouts/application (0.2ms)
2013-04-19T16:08:01.536160+00:00 heroku[router]: at=info method=GET path=/ host=guarded-headland-2911.herokuapp.com fwd="98.154.183.5" dyno=web.1 connect=9ms service=82ms status=500 bytes=643

我的样式表 application.css 文件如下所示:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
 */

gemfile 看起来像这样:

source 'https://rubygems.org'

gem 'rails', '3.2.13'
gem 'jquery-rails'
gem 'spree', '1.3.2'
gem 'spree_gateway', :github => 'spree/spree_gateway', :branch => '1-3-stable'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-3-stable'

group :production do
    gem 'pg'
end

group :development, :test do
    gem 'sqlite3'
end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'bootstrap-sass', '~> 2.3.1'

end
4

1 回答 1

1

如果我的评论不起作用。然后我建议以下。

  1. 更改application.cssapplication.css.scss

  2. *= require_tree .从中删除 application.css.scss

  3. 将以下行添加@import "bootstrap";到文件中的页面底部application.css.scss

唯一的问题是您将删除 Spree CSS 文件,因此 Spree 布局看起来不正确。目前 Spree 不提供对 Bootstrap 的官方支持。如果这不起作用,希望对 Spree 有更多了解的人可以帮助您。

于 2013-04-19T19:46:30.637 回答