我最近学习了node.js并希望部署我的项目,我在Heroku上做了。但是,Heroku正在向我提供下面复制的错误消息。虽然我已经记录了错误,但我仍然无法找到解决方案。
以下是日志:
2016-04-13T14:24:17.248681+00:00 heroku[web.1]: Process exited with status 1
2016-04-13T14:24:17.256460+00:00 heroku[web.1]: State changed from starting to c
rashed
2016-04-13T14:24:30.863162+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=770f4364-
859f-453a-a09c-7f23ddaf6eca fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:24:31.537783+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=16af5073-
7bb2-431e-bc08-b2fb6773eab8 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:27:59.122567+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=c6ba2f2f-
7379-41bf-afc9-550c309e7200 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:17.354776+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=088965d7-
ddcf-46ba-a44c-ed1486938993 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:21.657898+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=94d1eceb-
fa46-4795-82f6-4c369eb04fb6 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:24.198371+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=6ff6b6be-
e29c-4a5b-b48b-cbf4f4850ccf fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:28.987226+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=1a1709f0-
9967-4ff0-a9d3-473e147c23e1 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
这是错误:
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
答案 0 :(得分:1)
node.js服务器在路由/
上的HTTP GET请求时崩溃。这不是平台错误,而是代码错误(可能是您的index.js文件)。您需要检查代码行之间的错误:
app.get('/', function(req, res) {
//likely some syntax error here
}
我强烈建议您使用以下命令在本地计算机上运行应用程序:node index.js
,以查看HTTP GET代码的哪一部分导致错误。 CLI将给出导致错误的特定行号。
Heroku Local也是在将应用部署到heroku之前测试应用的绝佳工具。