我尝试将完整的应用程序从GitHub部署到Heroku,但出现503错误,尽管在本地计算机上运行良好。会发生什么问题?
2019-03-05T09:04:17.530233+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=message-board-byjb.herokuapp.com request_id=0f57c216-cf0e-46fa-a8fd-1e003b29e0ac fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:04:17.999176+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=message-board-byjb.herokuapp.com request_id=420d10af-fd3b-43b7-ab5b-9c925e6e520b fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:06:10.224358+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=message-board-byjb.herokuapp.com request_id=5c7b5ba0-3e8a-4e4c-9a4c-38e7e3c47079 fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:06:10.714879+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=message-board-byjb.herokuapp.com request_id=7eca85fd-6018-41d7-897a-5fbf1b40fcbb fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:06:13.775830+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=message-board-byjb.herokuapp.com request_id=9673bc4f-e6a3-4945-84a4-c2de1a8abef5 fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:06:14.300128+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=message-board-byjb.herokuapp.com request_id=9f7a5839-ea06-4cb7-b465-c74f4b6d23ac fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:06:14.765410+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=message-board-byjb.herokuapp.com request_id=95c16b9d-c257-43d9-9d94-ae6ab13b0fb3 fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:06:15.673564+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=message-board-byjb.herokuapp.com request_id=960484dc-7edb-4975-9d4e-7ad62c153994 fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:22:41.651010+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=message-board-byjb.herokuapp.com request_id=c1be111c-b3bd-47d6-aa15-4b54caf5bbff fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
2019-03-05T09:22:42.127315+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=message-board-byjb.herokuapp.com request_id=682549c5-670e-4542-84d6-400671d623a4 fwd="85.26.235.56" dyno= connect= service= status=503 bytes= protocol=https
UPD:server.js的内容:
const express = require("express");
const logger = require("morgan");
const API_PORT = 3001;
const app = express();
const router = require('./routers/board');
app.use(logger("dev"));
app.use('/api', router);
app.listen(API_PORT, () => {
console.log(`LISTENING ON PORT ${API_PORT}`)
});
反应环境使用3000端口。该项目由“后端”和“前端”目录组成。在“ frontend”目录的package.json中,
"proxy": "http://localhost:3001"
答案 0 :(得分:0)
更改
const API_PORT = 3001;
到
const API_PORT = process.env.PORT || 3001