0
0

More than 3 years have passed since last update.

herokuデプロイ中precompiling assets failedとエラーが出た時

Posted at

ローカル環境では問題なく動いていたのにherokuでデプロイ中にprecompiling assets failedとエラーが出たので解決方法をまとめます。

logを調べているうちに環境内に問題がありそうだったので
ターミナルでエラー解析をします。


 RAILS_ENV=development bin/rails assets:precompile

こちらを実行することで開発環境ないでエラーがないかを確認することができます。

中身を見てみると、、、


warning Integrity check: Flags don't match                                     
error Integrity check failed                                                   
error Found 1 errors.                                                          


========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================


To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).

ローカルでyarnを最新の状態にしているからなのかファイルのバージョンに古いのがあったためupdateする必要があったのかなと思います。

また、

To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).

このままではチェックと指示があるので下記のように変更します。 

/config/webpacker.yml

check_yarn_integrity: false

この状態でもエラーが出たので下記コマンドで本番環境で問題がないか確認してみます。

RAILS_ENV=production bin/rails assets:precompile

UnitConversionError Incompatible units: 'px' and ‘%’

imcompatibleは相容れないという意味なんおでpxと%を同時に使っている可能性があります。


.main{
  height: (100% - 780px);
  margin: 0 auto;
}

heightの計算にcalcを書いてない!!


.main{
  height: calc(100% - 780px);
  margin: 0 auto;
}

もう一度デプロイするとうまくいきました。

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