0
0

More than 5 years have passed since last update.

docker-composeのrails環境で、bootstrap4が反映されない時〜

Posted at

DockerでRailsの開発環境を構築したのですが、Bootstrap4の導入でハマったため投稿します。

公式サイトの手順に沿ってインストール

まず以下の公式サイトに従って導入しました。
Bootstrap4

エラー発生

ActionView::Template::Error (Autoprefixer doesn’t support Node v4.8.2. Update it.):

AutoprefixerがNode v4.8.2のサポートしていないため、updateしてくださいエラー。
大人しくアップデートするか、もしくは以下のgemをGemfileに追記。

Gemfile
gem 'mini_racer'

bundle installを実行。

またエラー発生

ActionView::Template::Error (File to import not found or unreadable: bootstrap.

bootstrapを読み込めないというエラー。
bundle installを実行しているのになぜだろうとログを見ていると、
何回実行してもinstalling bootstrap4が走っている。
これキャッシュ関係してるとかある・・・?と疑問に思い調べてみました。
以下を実行し、エラーは解消できました。

docker-compose build --no-cache

めでたくbootstrap4導入完了

アプリ画面を確認するとちゃんとbootstrapがちゃんと反映されていました!
調べている最中は悔しい気持ちでいっぱいになるのに、
なんだかんだずっと続けられるのは、達成した喜びがあるからかなと改めて感じました。

参考サイト:
Bootstrap4
Dockerでコンテナ内にbundle installされない問題の解決法

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0