LoginSignup
1
0

More than 1 year has passed since last update.

git push heroku master時のエラー!Precompiling assets failed.

Posted at

git push heroku master時に以下のエラーが発生した際の解決策を記録

新規アプリケーションをherokuへ反映する際にエラーが発生した。

ターミナル上のエラー文.
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/アプリ名.git'

原因を調査してみると、ターミナル上に

ターミナル上のエラー文.
Precompiling assets failed.

という文があった。

これは「アセットのプリコンパイルに失敗しました」という意味だった。

しっかりと上までターミナルを見てみると
ModuleNotFoundError: Module not found: Error: Can't resolve '../tweets' in '/tmp/build_259621bf/app/javascript/packs'というメソッドエラーがあった。

おそらくapp/javascript/packs内で不要な記述をしているのだと思い、
確認すると削除したjavascriptファイルを読み込む記述をしていた。

すぐに削除しコミットプッシュを行い、再度git push heroku masterを実行。

すると問題なくデプロイが成功!

git push heroku master時のエラーは慌てず冷静にログを確認し原因を調査することが大事だと感じた。

※認識が間違っていましたらご指摘いただけると幸いです。

以上

1
0
1

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
1
0