尝试部署节点应用程序时,我收到以下Heroku日志。我无法找出原因。我猜想这与我的index.html
文件中的收藏夹链接有关吗?
Heroku日志
2020-03-25T14:07:37.323633+00:00 app[web.1]: > react-scripts start
2020-03-25T14:07:37.323633+00:00 app[web.1]:
2020-03-25T14:07:40.667543+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.16.68.202/
2020-03-25T14:07:40.668023+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-03-25T14:07:40.668162+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-03-25T14:07:40.668280+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-03-25T14:07:40.668531+00:00 app[web.1]: Starting the development server...
2020-03-25T14:07:40.668533+00:00 app[web.1]:
2020-03-25T14:07:40.815780+00:00 heroku[web.1]: State changed from starting to crashed
2020-03-25T14:07:40.794329+00:00 heroku[web.1]: Process exited with status 0
2020-03-25T16:50:20.606050+00:00 heroku[web.1]: State changed from crashed to starting
2020-03-25T16:50:29.481448+00:00 heroku[web.1]: Starting process with command `npm start`
2020-03-25T16:50:32.126241+00:00 app[web.1]: npm WARN npm npm does not support Node.js v12.16.1
2020-03-25T16:50:32.126628+00:00 app[web.1]: npm WARN npm You should probably upgrade to a newer version of node as we
2020-03-25T16:50:32.126812+00:00 app[web.1]: npm WARN npm can't make any promises that npm will work with this version.
2020-03-25T16:50:32.127129+00:00 app[web.1]: npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
2020-03-25T16:50:32.127378+00:00 app[web.1]: npm WARN npm You can find the latest version at https://nodejs.org/
2020-03-25T16:50:32.263784+00:00 app[web.1]:
2020-03-25T16:50:32.263791+00:00 app[web.1]: > project-x@0.1.0 start /app
2020-03-25T16:50:32.263792+00:00 app[web.1]: > react-scripts start
2020-03-25T16:50:32.263792+00:00 app[web.1]:
2020-03-25T16:50:34.783181+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.18.253.226/
2020-03-25T16:50:34.783787+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-03-25T16:50:34.783888+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-03-25T16:50:34.783977+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-03-25T16:50:34.784185+00:00 app[web.1]: Starting the development server...
2020-03-25T16:50:34.784187+00:00 app[web.1]:
2020-03-25T16:50:34.903396+00:00 heroku[web.1]: State changed from starting to crashed
2020-03-25T16:50:34.886104+00:00 heroku[web.1]: Process exited with status 0
2020-03-25T20:32:58.790170+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=hidden-stream-53835.herokuapp.com request_id=d958c692-68ad-4723-a7da-1b0fb261e74b fwd="73.60.116.154" dyno= connect= service= status=503 bytes= protocol=https
2020-03-25T20:32:59.217144+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=hidden-stream-53835.herokuapp.com request_id=1e9dbfb7-070b-485e-906b-a30a2e0dcc35 fwd="73.60.116.154" dyno= connect= service= status=503 bytes= protocol=https
index.html
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
答案 0 :(得分:1)
一次分配给您的IP地址都会经常更改。不要特别地绑定它们。
相反,绑定到所有可用的 IP地址,该地址通常由0.0.0.0
表示或根本不提供IP地址。确保还使用Heroku通过PORT
环境变量指定的端口。
假设您正在使用Express,something like this should work:
const express = require('express')
const PORT = process.env.PORT || 5000 # Fall back to port 5000 if process.env.PORT is not set
express()
.listen(PORT, () => console.log(`Listening on ${ PORT }`))