Herokuデプロイ時のエラー
やりたいこと
Herokuデプロイ時にエラーが現れたので現れたので解消したい。
remote: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to healthy-combi. remote: To https://git.heroku.com/healthy-combi.git ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/healthy-combi.git' urakamitakuya@urakamiuyanoMBP conve_recipe % git checkout -b message Switched to a new branch 'message'
調査
heroku logs --tail
2021-10-08T03:55:33.071559+00:00 app[web.1]: [9248df1e-fcc3-43b0-95a2-cd14e7ad95e1] 42: <div class="concept-img"> 2021-10-08T03:55:33.071560+00:00 app[web.1]: [9248df1e-fcc3-43b0-95a2-cd14e7ad95e1] 43: <%= image_pack_tag("media/images/boxed.jpg", class: 'w-100') %> 2021-10-08T03:55:33.071560+00:00 app[web.1]: [9248df1e-fcc3-43b0-95a2-cd14e7ad95e1] 44: </div> 2021-10-08T03:55:33.071561+00:00 app[web.1]: [9248df1e-fcc3-43b0-95a2-cd14e7ad95e1] 45: <div class="concept-text-box"> 2021-10-08T03:55:33.071561+00:00 app[web.1]: [9248df1e-fcc3-43b0-95a2-cd14e7ad95e1] 46: <div class="concept-text-main"> 2021-10-08T03:55:33.071561+00:00 app[web.1]: [9248df1e-fcc3-43b0-95a2-cd14e7ad95e1] 2021-10-08T03:55:33.071562+00:00 app[web.1]: [9248df1e-fcc3-43b0-95a2-cd14e7ad95e1] app/views/static_pages/home.html.erb:43 2021-10-08T03:55:33.072062+00:00 heroku[router]: at=info method=GET path="/" host=healthy-combi.herokuapp.com request_id=9248df1e-fcc3-43b0-95a2-cd14e7ad95e1 fwd="60.66.51.144" dyno=web.1 connect=0ms service=5ms status=500 bytes=1827 protocol=https
エラー解決
webpackerに移行したがimage_pack_tagが読み込まれていない事が原因だった。
application.js内の以下の記述をコメントアウトするのを忘れていました。 application.js
const images = require.context('../images/', true)