我最近部署了简单的node.js工作,它可以进行网络聊天,非常简单的代码。但是当我访问部署的URL时,会说:
应用程序错误应用程序和页面中发生错误 无法提供服务。请稍后再试。
如果您是应用程序所有者,请查看日志以获取详细信息。
我检查了日志:
2016-10-18T05:25:28.021356+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-10-18T05:25:28.021357+00:00 app[web.1]: at Object.<anonymous> (/app/app/web/index.js:3:17)
2016-10-18T05:25:28.021357+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-10-18T05:25:28.021356+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-10-18T05:25:28.021358+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-10-18T05:25:28.021358+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-10-18T05:25:28.021359+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-10-18T05:25:28.021370+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-10-18T05:25:28.152443+00:00 heroku[web.1]: State changed from starting to crashed
2016-10-18T05:25:28.982052+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=realtime-web-chat-simple.herokuapp.com request_id=93c0506d-02e9-4505-a357-9e8d6578d007 fwd="45.56.152.21" dyno= connect= service= status=503 bytes=
2016-10-18T05:25:30.286843+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=realtime-web-chat-simple.herokuapp.com request_id=2a3caade-896a-4ae2-8fd9-6e5ec66fed78 fwd="45.56.152.21" dyno= connect= service= status=503 bytes=
我的package.json如下:
{
"name": "RealTimeWebChat",
"version": "0.0.0",
"description": "real time web chat using node.js power :D",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/CodeKnight986/webchat.git"
},
"keywords": [],
"author": "",
"dependencies": {
"socket.io": "latest",
"express-handlebars": "3.0.0",
"express-session": "1.13.0",
"passport": "0.3.2",
"passport-local": "1.0.0",
"html-entities": "1.2.0"
},
"author": "ray - codeknight"
}
任何帮助将不胜感激。
答案 0 :(得分:2)
如果它在本地工作,或许对set Node and npm versions on package.json有好处,以便使用您在本地使用的相同版本。
如果它不起作用,您也可以尝试添加Procfile来指定要运行的命令
答案 1 :(得分:0)
谢谢。