Heroku node.js的应用程序错误

时间:2014-09-07 07:35:52

标签: node.js heroku express

我试图将我的node.js应用程序推送到Heroku。当我在本地运行node app时,它完美运行。当我运行git push heroku进行部署时,命令行上也没有发生错误。然而,当我执行heroku open时,应用程序错误'页面出现。然后我做了heroku run bash直接进入服务器并在其上运行node app,并且再次没有错误。仍然,应用程序错误出现在网页上。

当我通过heroku logs --tail检查日志时,出现以下错误:

2014-09-07T05:43:16.819546+00:00 heroku[web.1]: State changed from crashed to starting
2014-09-07T05:43:18.617745+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-09-07T05:43:19.219404+00:00 app[web.1]: module.js:340
2014-09-07T05:43:19.219809+00:00 app[web.1]:     throw err;
2014-09-07T05:43:19.219814+00:00 app[web.1]:           ^
2014-09-07T05:43:19.219075+00:00 app[web.1]: 
2014-09-07T05:43:19.222538+00:00 app[web.1]: Error: Cannot find module 'express'
2014-09-07T05:43:19.222541+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
2014-09-07T05:43:19.222543+00:00 app[web.1]:     at Module.require (module.js:364:17)
2014-09-07T05:43:19.222547+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2014-09-07T05:43:19.222542+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
2014-09-07T05:43:19.222550+00:00 app[web.1]:     at Module.load (module.js:356:32)
2014-09-07T05:43:19.222545+00:00 app[web.1]:     at require (module.js:380:17)
2014-09-07T05:43:19.222546+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:1:77)
2014-09-07T05:43:19.222549+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2014-09-07T05:43:19.222553+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2014-09-07T05:43:19.222551+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2014-09-07T05:43:19.944481+00:00 heroku[web.1]: Process exited with status 8
2014-09-07T05:43:19.958025+00:00 heroku[web.1]: State changed from starting to crashed
2014-09-07T06:31:23.233643+00:00 heroku[web.1]: State changed from cra
shed to starting
2014-09-07T06:31:25.484465+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-09-07T06:31:26.746959+00:00 app[web.1]: 
2014-09-07T06:31:26.747625+00:00 app[web.1]:     throw err;
2014-09-07T06:31:26.754734+00:00 app[web.1]: Error: Cannot find module 'express'
2014-09-07T06:31:26.747455+00:00 app[web.1]: module.js:340
2014-09-07T06:31:26.754750+00:00 app[web.1]:     at Module.load (module.js:356:32)
2014-09-07T06:31:26.754754+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2014-09-07T06:31:26.747630+00:00 app[web.1]:           ^
2014-09-07T06:31:26.754752+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2014-09-07T06:31:26.754749+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2014-09-07T06:31:26.754742+00:00 app[web.1]:     at Module.require (module.js:364:17)
2014-09-07T06:31:26.754740+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
2014-09-07T06:31:26.754744+00:00 app[web.1]:     at require (module.js:380:17)
2014-09-07T06:31:26.754746+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:1:77)
2014-09-07T06:31:26.754747+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2014-09-07T06:31:26.754739+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
2014-09-07T06:31:27.640851+00:00 heroku[web.1]: Process exited with status 8
2014-09-07T06:31:27.648865+00:00 heroku[web.1]: State changed from starting to crashed
2014-09-07T06:57:24.387733+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=redefining-web-design.herokuapp.com request_id=b20732af-40f4-4705-bd85-16a605b4c8ed fwd="116.15.50.88   ,220.255.2.31" dyno= connect= service= status=503 bytes=
2014-09-07T07:11:52.954250+00:00 heroku[api]: Starting process with command `bash` by anthony.send@gmail.com
2014-09-07T07:11:54.845805+00:00 heroku[run.7802]: Awaiting client
2014-09-07T07:11:55.877349+00:00 heroku[run.7802]: Starting process with command `bash`
2014-09-07T07:11:55.214871+00:00 heroku[run.7802]: State changed from starting to up
2014-09-07T07:16:32.135955+00:00 heroku[run.7802]: Process exited with status 130
2014-09-07T07:16:32.147198+00:00 heroku[run.7802]: State changed from up to complete
2014-09-07T07:16:43+00:00 heroku[slug-compiler]: Slug compilation started
2014-09-07T07:16:46.543796+00:00 heroku[api]: Deploy b88168d by anthony.send@gmail.com
2014-09-07T07:16:46.543796+00:00 heroku[api]: Release v5 created by anthony.send@gmail.com
2014-09-07T07:16:46+00:00 heroku[slug-compiler]: Slug compilation finished
2014-09-07T07:16:46.727022+00:00 heroku[web.1]: State changed from crashed to starting
2014-09-07T07:16:48.970345+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-09-07T07:16:49.649144+00:00 app[web.1]: module.js:340
2014-09-07T07:16:49.649150+00:00 app[web.1]:     throw err;
2014-09-07T07:16:49.649154+00:00 app[web.1]:           ^
2014-09-07T07:16:49.652236+00:00 app[web.1]:     at require (module.js:380:17)
2014-09-07T07:16:49.652226+00:00 app[web.1]: Error: Cannot find module 'express'
2014-09-07T07:16:49.652240+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2014-09-07T07:16:49.652231+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
2014-09-07T07:16:49.652239+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2014-09-07T07:16:49.652232+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
2014-09-07T07:16:49.652234+00:00 app[web.1]:     at Module.require (module.js:364:17)
2014-09-07T07:16:49.652242+00:00 app[web.1]:     at Module.load (module.js:356:32)
2014-09-07T07:16:49.652245+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2014-09-07T07:16:49.652243+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2014-09-07T07:16:49.652238+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:1:77)
2014-09-07T07:16:49.648613+00:00 app[web.1]: 
2014-09-07T07:16:50.430646+00:00 heroku[web.1]: State changed from starting to crashed
2014-09-07T07:16:50.431568+00:00 heroku[web.1]: State c
hanged from crashed to starting
2014-09-07T07:16:50.412485+00:00 heroku[web.1]: Process exited with status 8
2014-09-07T07:16:51.795738+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-09-07T07:16:52.326711+00:00 app[web.1]: module.js:340
2014-09-07T07:16:52.327018+00:00 app[web.1]:           ^
2014-09-07T07:16:52.330126+00:00 app[web.1]: Error: Cannot find module 'express'
2014-09-07T07:16:52.330131+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
2014-09-07T07:16:52.326262+00:00 app[web.1]: 
2014-09-07T07:16:52.327010+00:00 app[web.1]:     throw err;
2014-09-07T07:16:52.330134+00:00 app[web.1]:     at Module.require (module.js:364:17)
2014-09-07T07:16:52.330141+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2014-09-07T07:16:52.330143+00:00 app[web.1]:     at Module.load (module.js:356:32)
2014-09-07T07:16:52.330144+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2014-09-07T07:16:52.330146+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2014-09-07T07:16:52.330137+00:00 app[web.1]:     at require (module.js:380:17)
2014-09-07T07:16:52.330133+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
2014-09-07T07:16:52.330138+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:1:77)
2014-09-07T07:16:52.330140+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2014-09-07T07:16:53.006419+00:00 
heroku[web.1]: State changed from starting to crashed
2014-09-07T07:16:53.355392+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=redefining-web-design.herokuapp.com request_id=3126eef5-0ab0-4932-b3cf-dbb97e21d5ef fwd="54.234.54.24" dyno= connect= service= status=503 bytes=
2014-09-07T07:16:54.988896+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=redefining-web-design.herokuapp.com request_id=bc0dfc6b-3983-4bde-afec-62c872883713 fwd="116.15.50.88   ,220.255.2.215" dyno= connect= service= status=503 bytes=
2014-09-07T07:18:34.403133+00:00 heroku[api]: Starting process with command `bash` by anthony.send@gmail.com
2014-09-07T07:18:36.327048+00:00 heroku[run.5491]: Awaiting client
2014-09-07T07:18:36.823328+00:00 heroku[run.5491]: Starting process with command `bash`
2014-09-07T07:18:36.622179+00:00 heroku[run.5491]: State changed from starting to up
2014-09-07T07:19:06.382664+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=redefining-web-design.herokuapp.com request_id=14b3e7e1-3ecc-4666-9f97-4ca70d6f5924 fwd="116.15.50.88   ,220.255.2.66" dyno= connect= service= status=503 bytes=
2014-09-07T07:19:52.190628+00:00 heroku[api]: Starting process with command `bash` by anthony.send@gmail.com
2014-09-07T07:19:53.926014+00:00 heroku[run.1948]: Awaiting client
2014-09-07T07:19:54.940182+00:00 heroku[run.1948]: Starting process with command `bash`
2014-09-07T07:19:54.247484+00:00 heroku[run.1948]: State changed from starting to up
2014-09-07T07:20:04.500159+00:00 heroku[run.1948]: State changed from up to complete
2014-09-07T07:20:04.492947+00:00 heroku[run.1948]: Process exited with status 130
2014-09-07T07:21:23.644016+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=redefining-web-design.herokuapp.com request_id=9db4918d-1f68-4329-a3cc-6a8a3f9817e5 fwd="116.15.50.88   ,220.255.2.188" dyno= connect= service= status=503 bytes=
2014-09-07T07:25:06.104220+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=redefining-web-design.herokuapp.com request_id=c39ecaf6-34af-4a5e-a728-0c6bfe223ce6 fwd="116.15.50.88   ,220.255.2.36" dyno= connect= service= status=503 bytes=

所以似乎发生的事情是Heroku无法找到Express。虽然我确实没有把整个node_module文件夹推上去我确实在我的.gitignore中指定了node_modules,我很确定这不是问题所在。我确信我在文档中读到Heroku将我推送应用程序时安装所需的模块。此外,我再次进行了heroku run bash并进行了双重检查,果然,还有一个node_modules文件夹,其中包含express和ejs-locals。

现在我真的不知道发生了什么。如果有人能在这方面给我启发,我将非常感激 - 非常感谢提前。

0 个答案:

没有答案