最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

Heroku未能在60秒内绑定PORT

IT培训 admin 4浏览 0评论

Heroku未能在60秒内绑定PORT

今天我将我的应用程序从创建反应应用程序移动到razzle for SSR但是heroku无法绑定PORT,我读了其他问题但是找不到这样的问题我已经正确设置了PORT但仍然无法绑定它

"scripts": {
"dev": "razzle start",
"build": "razzle build",
"test": "razzle test --env=jsdom",
"start": "NODE_ENV=production node build/server.js",
"heroku-postbuild": "yarn build"
},

 // const port = process.env.PORT || 4000;
export default express()
.use((req, res) => app.handle(req, res))
.listen(process.env.PORT || 4000, function(err) {
  if (err) {
  console.error(err);
  return;
}
console.log(`> Started server`);
});

日志

2019-02-13T17:56:08.700969+00:00 app[web.1]: > NODE_ENV=production 
node build/server.js
2019-02-13T17:56:08.700971+00:00 app[web.1]: 
2019-02-13T17:56:10.910281+00:00 app[web.1]: > Started server
2019-02-13T17:56:12.000000+00:00 app[api]: Build succeeded
2019-02-13T17:57:05.112846+00:00 heroku[web.1]: State changed from starting to crashed
2019-02-13T17:57:05.119328+00:00 heroku[web.1]: State changed from crashed to starting
2019-02-13T17:57:04.991380+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-02-13T17:57:04.991503+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-02-13T17:57:05.096022+00:00 heroku[web.1]: Process exited with status 137
2019-02-13T17:57:18.472313+00:00 heroku[web.1]: Starting process with command `npm start`
2019-02-13T17:57:21.719632+00:00 app[web.1]: 
2019-02-13T17:57:21.719660+00:00 app[web.1]: > *`enter code here`@2.0.1 start /app
2019-02-13T17:57:21.719662+00:00 app[web.1]: > NODE_ENV=production node build/server.js
2019-02-13T17:57:21.719663+00:00 app[web.1]: 
2019-02-13T17:57:23.071400+00:00 app[web.1]: > Started server
2019-02-13T17:57:36.325346+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=*.herokuapp request_id=d322452e-de5a-479b-831a-a0345864671d 
fwd="193.172.191.16" dyno= connect= service= status=503 bytes= protocol=https`
回答如下:

我遇到了同样的问题并改变了端口

const app = express()
const port = 8000
app.listen(port)

.listen(process.env.PORT || 8000)

为我解决了这个问题

But when I researched, I find out this answer could help

https://github/keystonejs/keystone/issues/3994#issuecomment-280639251

It basically says that removeing this from package.json might solve the issue
"engines": {
    "node": ">=0.10.22",
    "npm": ">=1.3.14"
  },

Heroku未能在60秒内绑定PORT

今天我将我的应用程序从创建反应应用程序移动到razzle for SSR但是heroku无法绑定PORT,我读了其他问题但是找不到这样的问题我已经正确设置了PORT但仍然无法绑定它

"scripts": {
"dev": "razzle start",
"build": "razzle build",
"test": "razzle test --env=jsdom",
"start": "NODE_ENV=production node build/server.js",
"heroku-postbuild": "yarn build"
},

 // const port = process.env.PORT || 4000;
export default express()
.use((req, res) => app.handle(req, res))
.listen(process.env.PORT || 4000, function(err) {
  if (err) {
  console.error(err);
  return;
}
console.log(`> Started server`);
});

日志

2019-02-13T17:56:08.700969+00:00 app[web.1]: > NODE_ENV=production 
node build/server.js
2019-02-13T17:56:08.700971+00:00 app[web.1]: 
2019-02-13T17:56:10.910281+00:00 app[web.1]: > Started server
2019-02-13T17:56:12.000000+00:00 app[api]: Build succeeded
2019-02-13T17:57:05.112846+00:00 heroku[web.1]: State changed from starting to crashed
2019-02-13T17:57:05.119328+00:00 heroku[web.1]: State changed from crashed to starting
2019-02-13T17:57:04.991380+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-02-13T17:57:04.991503+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-02-13T17:57:05.096022+00:00 heroku[web.1]: Process exited with status 137
2019-02-13T17:57:18.472313+00:00 heroku[web.1]: Starting process with command `npm start`
2019-02-13T17:57:21.719632+00:00 app[web.1]: 
2019-02-13T17:57:21.719660+00:00 app[web.1]: > *`enter code here`@2.0.1 start /app
2019-02-13T17:57:21.719662+00:00 app[web.1]: > NODE_ENV=production node build/server.js
2019-02-13T17:57:21.719663+00:00 app[web.1]: 
2019-02-13T17:57:23.071400+00:00 app[web.1]: > Started server
2019-02-13T17:57:36.325346+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=*.herokuapp request_id=d322452e-de5a-479b-831a-a0345864671d 
fwd="193.172.191.16" dyno= connect= service= status=503 bytes= protocol=https`
回答如下:

我遇到了同样的问题并改变了端口

const app = express()
const port = 8000
app.listen(port)

.listen(process.env.PORT || 8000)

为我解决了这个问题

But when I researched, I find out this answer could help

https://github/keystonejs/keystone/issues/3994#issuecomment-280639251

It basically says that removeing this from package.json might solve the issue
"engines": {
    "node": ">=0.10.22",
    "npm": ">=1.3.14"
  },

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论