LoginSignup
3
3

More than 3 years have passed since last update.

[Application Error] React Appデプロイ時のerror code=H10の対処法

Posted at

最近の勉強で学んだ事を、ノート代わりにまとめていきます。
主に自分の学習の流れを振り返りで残す形なので色々、省いてます。
Webエンジニアの諸先輩方からアドバイスやご指摘を頂けたらありがたいです!

デプロイ後にApplication Errorが発生

エラーが起きているのでログを確認

heroku logs --tail

これで吐き出されたログを確認した所、この様なエラーを確認

2020-05-05T07:07:32.860460+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=whispering-sea-42324.herokuapp.com request_id=2edb01db-d450-42c4-a2d5-054d2ddf7c0a fwd="92.202.236.201" dyno= connect= service= status=503 bytes= protocol=https
2020-05-05T07:07:34.265598+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=whispering-sea-42324.herokuapp.com request_id=d0d71346-05ff-4c2f-89dc-8872ab99ac61 fwd="92.202.236.201" dyno= connect= service= status=503 bytes= protocol=https

アプリがクラッシュしている模様
H10 - App crashed

どうやらcreate-react-appのstart scriptに問題があるみたいです。

npm install --save serve

package.jsonの内容を以下の様にいたしましたら無事解決しました!

package.json
"scripts": {
    "dev": "react-scripts start",
    "heroku-postbuild": "npm run build",
    "start": "serve -s build",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

参考記事

How to Fix Heroku Application Error For a Successfully Deployed React App
React App runs locally but crashes with error code=H10 on Heroku
React app runs locally, crashes when on Heroku error code=H10

3
3
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
3
3