Reactjs 将Next.js项目部署到Heroku失败

Reactjs 将Next.js项目部署到Heroku失败,reactjs,heroku,next.js,Reactjs,Heroku,Next.js,我正试图在heroku上部署我的next.js项目,但在应用程序运行时,它失败了,这是失败的日志 2019-11-17T18:23:33.067077+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pens-nextjs.herokuapp.com request_id=f01abc4b-bf9b-4f2e-8b8e-06184580bfc8 fwd="41.232.85.2

我正试图在heroku上部署我的next.js项目,但在应用程序运行时,它失败了,这是失败的日志

2019-11-17T18:23:33.067077+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pens-nextjs.herokuapp.com request_id=f01abc4b-bf9b-4f2e-8b8e-06184580bfc8 fwd="41.232.85.202" dyno= connect= service= status=503 bytes= protocol=https
2019-11-17T18:23:37.203987+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pens-nextjs.herokuapp.com request_id=f4f94391-c79c-4503-9751-fe8a6c5461d3 fwd="41.232.85.202" dyno= connect= service= status=503 bytes= protocol=https
2019-11-17T18:23:38.045712+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pens-nextjs.herokuapp.com request_id=98cc2b80-5631-4af1-9889-26abecca6aec fwd="41.232.85.202" dyno= connect= service= status=503 bytes= protocol=https

我也面临同样的问题。 我在我的NextJs应用程序的公用文件夹中添加了favicon.ico。另外,在package.json中添加以下行

"scripts": {
  "dev": "next",
  "build": "next build",
  "start": "next start -p $PORT",
  "heroku-postbuild": "npm run build",
  "test": "echo \"Error: no test specified\" && exit 1"
},

希望这对你有用

默认情况下,Next.js绑定到端口3000,而Heroku希望您的服务器进程绑定到
port
环境变量中提供的端口。您可以通过修改
package.json
使其具有
“start”:“Next start-p$port”

您的应用程序日志还说了什么?