简体   繁体   English

无法在heroku上部署节点应用程序。 仅显示欢迎消息

[英]Unable to deploy node app on heroku. Displays only welcome message

heroku logs heroku日志

 2018-04-20T20:45:50.151330+00:00 app[api]: Enable Logplex by user ghsklat2378123@gmail.com
 2018-04-20T20:45:50.059558+00:00 app[api]: Release v1 created by user ghsklat2378123@gmail.com
 2018-04-20T20:45:50.059558+00:00 app[api]: Initial release by user ghsklat2378123@gmail.com
 2018-04-20T20:45:50.151330+00:00 app[api]: Release v2 created by user ghsklat2378123@gmail.com
 2018-04-20T20:46:48.000000+00:00 app[api]: Build started by user ghsklat2378123@gmail.com
 2018-04-20T20:46:58.098188+00:00 app[api]: Deploy 2b289e67 by user ghsklat2378123@gmail.com
 2018-04-20T20:46:58.098188+00:00 app[api]: Release v3 created by user ghsklat2378123@gmail.com
 2018-04-20T20:46:48.000000+00:00 app[api]: Build succeeded
 2018-04-20T20:46:58.115335+00:00 app[api]: Scaled to web@1:Free by user ghsklat2378123@gmail.com
 2018-04-20T20:47:00.895268+00:00 heroku[web.1]: Starting process with command `npm start`
 2018-04-20T20:47:03.518908+00:00 app[web.1]: 
 2018-04-20T20:47:03.518933+00:00 app[web.1]: > node server.js
 2018-04-20T20:47:03.518931+00:00 app[web.1]: > stywqrrd@1.0.0 start /app
 2018-04-20T20:47:03.518935+00:00 app[web.1]: 
 2018-04-20T20:47:03.875652+00:00 app[web.1]: Express server listening on port 3000
 2018-04-20T20:48:01.013365+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
 2018-04-20T20:48:01.013866+00:00 heroku[web.1]: Stopping process with SIGKILL
 2018-04-20T20:48:01.152301+00:00 heroku[web.1]: State changed from starting to crashed
 2018-04-20T20:48:01.155261+00:00 heroku[web.1]: State changed from crashed to starting
 2018-04-20T20:48:01.132422+00:00 heroku[web.1]: Process exited with status 137
 2018-04-20T20:48:02.894892+00:00 heroku[web.1]: Starting process with command `npm start`
 2018-04-20T20:48:05.106690+00:00 app[web.1]: 
 2018-04-20T20:48:05.106708+00:00 app[web.1]: > sstywqrrd@1.0.0 start /app
 2018-04-20T20:48:05.106710+00:00 app[web.1]: > node server.js
 2018-04-20T20:48:05.106712+00:00 app[web.1]: 
 2018-04-20T20:48:05.295340+00:00 app[web.1]: Express server listening on port 3000

This is a very simple node app that i'm unable to deploy. 这是我无法部署的非常简单的节点应用程序。 When I got the link it displays: heroku welcome to you new app. Refer to documentation if you need help deploying 当我获得链接时,它将显示: heroku welcome to you new app. Refer to documentation if you need help deploying heroku welcome to you new app. Refer to documentation if you need help deploying . heroku welcome to you new app. Refer to documentation if you need help deploying Logs don't show any error(all logs shown in blue color). 日志不显示任何错误(所有日志均显示为蓝色)。 How do I solve this? 我该如何解决?

Cloned the repo and then did git init, git add, git commit 克隆仓库,然后执行git init,git add,git commit

heroku create
heroku git:remote -a safe-forest-59278
heroku apps:create myappName
git push heroku master

According to log statement 根据对帐单

Error R10 (Boot timeout) -> Web process failed to bind to $PORT
within 60 seconds of launch

This simply means that the port your are trying to connect with is not available for some reason. 这仅表示您尝试连接的端口由于某种原因不可用。

And most probably you're specifying the port like 而且最有可能您正在指定端口,例如

port = 3000

You should change this line to 您应该将此行更改为

port = process.env.PORT || 3000

This will let heroku servers to assign an available port to your server to listen to. 这将让heroku服务器为您的服务器分配一个可用端口以进行监听。

Why this happens is because mostly the ports that you specify while developing an application, there are very rare chances for that ports to be available and open in production. 发生这种情况的原因是,大多数情况下是因为您在开发应用程序时指定了端口,所以这些端口很少有机会在生产中可用并打开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在 heroku 上打开应用程序。 反应,node.js - Unable to open app on heroku. React, node.js 无法在Heroku上部署Node应用 - Unable to deploy Node app on Heroku Node.js应用程序适用于工头,但不适用于heroku。 404错误 - Node.js app works on foreman but not heroku. 404 Error 无法在Heroku上部署基于REST的Node.js APP - Unable to deploy REST based Node.js APP on heroku 如何将 React + Node.js 应用程序部署到 Heroku。 收到来自反应的 axios 请求的错误 405 - How to deploy React + Node.js application to Heroku. Getting error 405 on axios request from react 在 heroku 上部署应用程序时遇到问题。 错误代码 h10 - I'm having an issue tying to deploy app on heroku. Erro Code h10 将应用程序部署到 heroku. 节点后,来自 api 请求的 401 Unauthorized Access。 表示。 axios - 401 Unauthorized Access from api request after deploying app to heroku. node. express. axios 部署到Heroku后,Node应用无法点击API。 它说err :: Connection被拒绝 - Node app fails to hit API after Deployment to Heroku. It says err::Connection Refused 将 Node.js 应用程序部署到 Heroku。 错误 NPM_CONFIG_LOGLEVEL=错误 - Deploying Node.js app to Heroku. Error NPM_CONFIG_LOGLEVEL=error Heroku - EmberJS - 部署失败(无法下载节点) - Heroku - EmberJS - Deploy fail ( Unable download node )
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM