ローカル環境では、不具合は起きなかったが本番環境にてエラーが発生…
###開発環境
rails6
EC2
unicorn
##エラーコード
重要なところ↓
ActionView::Template::Error (couldn't find file 'bootstrap/dist/css/bootstrap.min.css' with type 'text/css'
それ以外の全てのエラーコード↓
[1a62c96b-5fbf-4c87-9194-2e16f8249139] ActionView::Template::Error (couldn't find file 'bootstrap/dist/css/bootstrap.min.css' with type 'text/css' Checked in these paths: /var/www/photo_roke/app/assets/config /var/www/photo_roke/app/assets/images /var/www/photo_roke/app/assets/stylesheets /home/ec2-user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/jquery-rails-4.4.0/vendor/assets/javascripts /home/ec2-user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actioncable-6.0.3.4/app/assets/javascripts /home/ec2-user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activestorage-6.0.3.4/app/assets/javascripts /home/ec2-user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actionview-6.0.3.4/lib/assets/compiled /var/www/photo_roke/node_modules): [1a62c96b-5fbf-4c87-9194-2e16f8249139] 17: <%# ログアウト %> [1a62c96b-5fbf-4c87-9194-2e16f8249139] 18: <div class='logout-container'> [1a62c96b-5fbf-4c87-9194-2e16f8249139] 19: <div class='logout-btn'> [1a62c96b-5fbf-4c87-9194-2e16f8249139] 20: <%= link_to image_tag('exit.png', class: "logout-icon"), destroy_user_session_path, method: :delete %> [1a62c96b-5fbf-4c87-9194-2e16f8249139] 21: </div> [1a62c96b-5fbf-4c87-9194-2e16f8249139] 22: <span class='logout-text'>ログアウト</span> [1a62c96b-5fbf-4c87-9194-2e16f8249139] 23: </div> [1a62c96b-5fbf-4c87-9194-2e16f8249139] [1a62c96b-5fbf-4c87-9194-2e16f8249139] app/assets/stylesheets/application.css:2 [1a62c96b-5fbf-4c87-9194-2e16f8249139] app/views/shared/_post_header.html.erb:20 [1a62c96b-5fbf-4c87-9194-2e16f8249139] app/views/photos/index.html.erb:1 I, [2020-11-11T21:19:36.774031 #31800] INFO -- : [855c62cf-eb33-46af-9f02-625afd32a671] Started GET "/" for 209.17.96.10 at 2020-11-11 21:19:36 +0000 I, [2020-11-11T21:19:36.774705 #31800] INFO -- : [855c62cf-eb33-46af-9f02-625afd32a671] Processing by PhotosController#index as HTML I, [2020-11-11T21:19:36.775472 #31800] INFO -- : [855c62cf-eb33-46af-9f02-625afd32a671] Redirected to http://54.248.19.145:3000/homes/home I, [2020-11-11T21:19:36.775556 #31800] INFO -- : [855c62cf-eb33-46af-9f02-625afd32a671] Filter chain halted as :move_to_index rendered or redirected I, [2020-11-11T21:19:36.775650 #31800] INFO -- : [855c62cf-eb33-46af-9f02-625afd32a671] Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 336)
このようになっております
boostroapは使用せずに開発をしておりましたがファイルがないよと言われてしまいます…
##実行したこと
bower で Bootstrap を入れたあと "couldn't find file 'bootstrap' with type 'text/css'" が表示される
この記事を参考に
gimfileにこの二つを記述
gemfile
1gem 'therubyracer' 2gem 'less-rails'
##追加コード
application.cssの中身になります!
ruby
1/* 2*= require bootstrap/dist/css/bootstrap.min.css 3 * This is a manifest file that'll be compiled into application.css, which will include all the files 4 * listed below. 5 * 6 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 7 * vendor/assets/stylesheets directory can be referenced here using a relative path. 8 * 9 * You're free to add application-wide styles to this file and they'll appear at the bottom of the 10 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 11 * files in this directory. Styles in this file should be added after the last require_* statement. 12 * It is generally better to create a new file per style scope. 13 * 14 *= require_tree . 15 *= require_self 16 */ 17 18 19
解決ができなかったため皆様方のお力をお借りしたいです!
よろしくお願いいたします!
回答1件
あなたの回答
tips
プレビュー