部署后出现Heroku状态错误503-如何解释错误代码?

时间:2020-07-21 00:31:31

标签: node.js heroku

在部署应用程序后,我的heroku日志中一直出现此错误。

我对此还很陌生,所以我不确定如何读取错误,但是我尝试了使用各种错误解决方案来检查视频或文档,但似乎都无法解决我的问题。

我在本地启动npm时,该应用程序运行正常。

2020-07-21T00:14:48.005621+00:00 heroku[web.1]: Process exited with status 0
2020-07-21T00:14:48.063048+00:00 heroku[web.1]: State changed from starting to crashed
2020-07-21T00:14:48.065696+00:00 heroku[web.1]: State changed from crashed to starting
2020-07-21T00:14:56.336931+00:00 heroku[web.1]: Starting process with command `npm start`
2020-07-21T00:14:58.630133+00:00 app[web.1]:
2020-07-21T00:14:58.630180+00:00 app[web.1]: > react-boilerplate@0.1.0 start /app
2020-07-21T00:14:58.630186+00:00 app[web.1]: > react-scripts start
2020-07-21T00:14:58.630187+00:00 app[web.1]:
2020-07-21T00:15:01.109832+00:00 app[web.1]: ℹ 「wds」: Project is running 
2020-07-21T00:15:01.110173+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-07-21T00:15:01.110259+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-07-21T00:15:01.110327+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-07-21T00:15:01.110510+00:00 app[web.1]: Starting the development server...
2020-07-21T00:15:01.110511+00:00 app[web.1]:
2020-07-21T00:15:01.202744+00:00 heroku[web.1]: Process exited with status 0
2020-07-21T00:15:01.245183+00:00 heroku[web.1]: State changed from starting to crashed
2020-07-21T00:15:01.917223+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gurinder-portfolio.herokuapp.com request_id=65f6d0c8-9c5c-4a2b-bf1f-4d9b01375469 fwd="73.151.234.70" dyno= connect= service= status=503 bytes= protocol=https
2020-07-21T00:15:03.216472+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gurinder-portfolio.herokuapp.com request_id=795a49db-2b8a-412c-9413-5eca14c1ee9b fwd="73.151.234.70" dyno= connect= service= status=503 bytes= protocol=https
2020-07-21T00:15:26.285931+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gurinder-portfolio.herokuapp.com request_id=0b4adb5c-3ab0-435c-9437-66798f48164f fwd="73.151.234.70" dyno= connect= service= status=503 bytes= protocol=https
2020-07-21T00:15:26.563460+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gurinder-portfolio.herokuapp.com request_id=8a5d7499-3b0e-4d80-a0bb-111ab0f15411 fwd="73.151.234.70" dyno= connect= service= status=503 bytes= protocol=https

Index.js

import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";

ReactDOM.render(
    <React.StrictMode>
        <App />,
    </React.StrictMode>,
    document.getElementById("root")
);

serviceWorker.unregister();

Package.json

{
  "name": "react-boilerplate",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

1 个答案:

答案 0 :(得分:0)

所以问题并不是我的代码真正引起的。我使用了错误的Heroku buildpack。这是一个React应用,我正在使用专门用于Node.JS的buildpack,所以我将buildpack切换到了这里的一个: https://elements.heroku.com/buildpacks/mars/create-react-app-buildpack#buildpack-instructions

现在,该应用已部署在Heroku上。希望这可以帮助其他任何人开始使用React应用程序和Heroku。谢谢所有尝试提供帮助的人。