2

アプリの基本的なスタイリングが完了しました。Twitter Bootstrap を使用しています....アプリは Heroku にデプロイされ、機能していましたが、Bootstrap スタイルの更新により、次のエラーが発生しています。

ActionView::Template::Error (/app/app/assets/stylesheets/application.css は既に必要です):

誰でもこれが何であるかについて考えを持っています。ここ数時間、ぐるぐる回っています。たくさんのものを試しました。ここで言及されているものの一部:

アプリケーションを Heroku にアップロードしようとしたときにのみ ActionView::Template::Error が発生するのはなぜですか?

2013-07-17T15:12:26.494137+00:00 app[web.1]: Started GET "/" for 71.203.124.202 at 2013-07-17 15:12:26 +0000
2013-07-17T15:12:27.403656+00:00 app[web.1]:     4:     %title
2013-07-17T15:12:27.403656+00:00 app[web.1]: 
2013-07-17T15:12:27.403656+00:00 app[web.1]: ActionView::Template::Error (/app/app/assets/stylesheets/application.css has already been required):
2013-07-17T15:12:27.403656+00:00 app[web.1]:     3:   %head                              
2013-07-17T15:12:27.403656+00:00 app[web.1]:     5:       Current Lines and Analysis
2013-07-17T15:12:27.403656+00:00 app[web.1]:     6:     = stylesheet_link_tag    "application", :media => "all"
2013-07-17T15:12:27.403656+00:00 app[web.1]:     7:     = javascript_include_tag "application"
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/navigation/_main_nav.html.haml (1.4ms)
2013-07-17T15:12:27.403656+00:00 app[web.1]:   app/views/layouts/posts.html.haml:6:in `_app_views_layouts_posts_html_haml___3387163029388442478_46287060'
2013-07-17T15:12:27.403656+00:00 app[web.1]:     8:     = csrf_meta_tags                                          
2013-07-17T15:12:27.403656+00:00 app[web.1]:     9:     :javascript
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_events_sort_toggle.html.haml (1.0ms)
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_main_flash.html.haml (0.1ms)
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_header.html.haml (4.5ms)
2013-07-17T15:12:27.403892+00:00 app[web.1]: 
2013-07-17T15:12:27.403892+00:00 app[web.1]: 
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_events_sidebar.html.haml (22.6ms)
2013-07-17T15:12:27.404248+00:00 app[web.1]: Completed 500 Internal Server Error in 904ms
2013-07-17T15:12:27.404086+00:00 app[web.1]: Processing by PostsController#index as HTML
2013-07-17T15:12:27.404248+00:00 app[web.1]:   Rendered posts/index.html.haml within layouts/posts (40.5ms)
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_posts_sort_toggle.html.haml (1.5ms)
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_posts_multi.html.haml (2.2ms)
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_hot-events-box.html.haml (2.0ms)
2013-07-17T15:12:27.404086+00:00 app[web.1]:   Rendered shared/_leagues_toggle.html.haml (2.6ms)
2013-07-17T15:12:27.404248+00:00 app[web.1]:   Rendered shared/_top_users_sidebar.html.haml (1.7ms)
2013-07-17T15:12:27.404215+00:00 heroku[router]: at=info method=GET path=/ host=www.webxxxxx.com fwd="xx.203.124.xxx" dyno=web.1 connect=1ms service=918ms status=500 bytes=643

application.css.scss ファイル


/*
 * 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 bootstrap
 *= require_tree .
 */

@import "bootstrap";

投稿のレイアウトからこれらの 2 行を削除すると、サイトはレンダリングされますが、スタイルはありません...


= stylesheet_link_tag    "application", :media => "all"
= javascript_include_tag "application"

ここに画像の説明を入力

何か案は?

4

4 に答える 4

3

application.cssディレクトリにファイルがあるかどうかを確認しますapp/assets/stylesheets。デフォルトrailsでは、あなたが持っているもののコンテンツを in に配置しapplication.css.scssますapplication.css。このファイルを作成して、デフォルトの .xml ファイルを削除し忘れた可能性がありますapplication.css

于 2013-07-17T22:01:41.097 に答える
2

おそらくあなたの問題に関連していますが、ソース管理を使用していて過去にマージを行ったことがあれば、require_tree に含まれる application.css.orig のようなスタイルシートができます。これと同じエラーが発生し、 *.orig ファイルを削除すると、すぐに解決しました。

基本的に、*.css.* という名前は、Rails に大混乱をもたらす可能性があります。

于 2014-04-09T07:43:45.337 に答える
0

require_tree を削除することがわかりました。ファイルを個別に追加するとうまくいきました。rails_admin を使用しているため、競合が発生している可能性がありますか???

この問題に遭遇した他の人のためにこれを提示します。

于 2013-07-18T14:47:58.197 に答える