简体   繁体   English

新的Heroku应用程序上的应用程序错误

[英]Application Error on new Heroku app

I know this question has been answered a lot, but I still can't figure out a solution to my problem. 我知道这个问题已经得到了很多回答,但是我仍然找不到解决问题的方法。 I've created a little app which is supposed to work with the Slack webhook. 我创建了一个应该与Slack webhook一起使用的小应用程序。 Locally, it works just fine - I use node app in order to launch it. 在本地,它工作得很好-我使用node app来启动它。

I've created my app on Heroku, pushed my files ( Procfile app.js hellobot.js package.json ) 我已经在Heroku上创建了我的应用,并推送了我的文件( Procfile app.js hellobot.js package.json

But when I visit http://slackbot2.herokuapp.com/ , I get an Application Error message. 但是,当我访问http://slackbot2.herokuapp.com/ ,我收到了应用程序错误消息。

I already tried the log but I get this : 我已经尝试过日志,但是我得到了:

2015-06-11T23:39:05.967607+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=slackbot2.herokuapp.com request_id=b3783c70-306b-4528-9d81-4e8ab43e9132 fwd="*******" dyno= connect= service= status=503 bytes= 2015-06-11T23:39:05.967607 + 00:00 heroku [router]:at =错误代码= H10 desc =“应用程序崩溃”方法= GET路径=“ /” host = slackbot2.herokuapp.com request_id = b3783c70-306b -4528-9d81-4e8ab43e9132 fwd =“ *******” dyno = connect = service = status = 503字节=

This heroku run rails console and heroku run rake db:migrate won't work. heroku run rails consoleheroku run rake db:migrate将不起作用。 bash: rails command not found . bash: rails command not found Rails and Rake are installed on my Mac (OSX 10.10.4). 我的Mac(OSX 10.10.4)上安装了Rails和Rake。 Those were the only solutions that worked for others .. But not me. 那是唯一对别人有用的解决方案..但不是我。

Same thing happened with me. 我也发生了同样的事情。 As far as I can remember, the reason for this is the port you used in the application. 据我所记得,其原因是您在应用程序中使用的端口。 Heroku will not run your app on port 8080 or 3000, instead it will be some random port. Heroku不会在端口8080或3000上运行您的应用程序,而是一个随机端口。 Use this code to fix the problem. 使用此代码可解决问题。

var port = process.env.PORT || 8080;

Use this code to start the server. 使用此代码启动服务器。

app.listen(port, function() { console.log('Our app is running on http://localhost:' + port); });

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM