为什么我的heroku应用程序崩溃?

时间:2016-03-13 00:28:43

标签: node.js heroku

这是我第一次尝试在heroku上部署应用程序时遇到应用程序错误,代码为H10和H13。

这是我在日志中看到的:

2016-03-13T00:12:52.715324+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0
.1:27017
2016-03-13T00:12:52.715325+00:00 app[web.1]:     at Object.exports._errnoExcepti
on (util.js:890:11)
2016-03-13T00:12:52.715325+00:00 app[web.1]:     at exports._exceptionWithHostPo
rt (util.js:913:20)
2016-03-13T00:12:52.715326+00:00 app[web.1]:     at TCPConnectWrap.afterConnect
[as oncomplete] (net.js:1057:14)
2016-03-13T00:12:52.723973+00:00 app[web.1]:
2016-03-13T00:12:52.731620+00:00 app[web.1]: npm ERR! Linux 3.13.0-77-generic
2016-03-13T00:12:52.732000+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bi
n/node" "/app/.heroku/node/bin/npm" "start"
2016-03-13T00:12:52.732236+00:00 app[web.1]: npm ERR! node v5.8.0
2016-03-13T00:12:52.732975+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-03-13T00:12:52.732648+00:00 app[web.1]: npm ERR! npm  v3.7.3
2016-03-13T00:12:52.733150+00:00 app[web.1]: npm ERR! clementinejs-fcc@1.0.1 sta
rt: `node server.js`
2016-03-13T00:12:52.733317+00:00 app[web.1]: npm ERR! Exit status 1
2016-03-13T00:12:52.733490+00:00 app[web.1]: npm ERR!
2016-03-13T00:12:52.733660+00:00 app[web.1]: npm ERR! Failed at the clementinejs
-fcc@1.0.1 start script 'node server.js'.
2016-03-13T00:12:52.733828+00:00 app[web.1]: npm ERR! Make sure you have the lat
est version of node.js and npm installed.
2016-03-13T00:12:52.733992+00:00 app[web.1]: npm ERR! If you do, this is most li
kely a problem with the clementinejs-fcc package,
2016-03-13T00:12:52.734149+00:00 app[web.1]: npm ERR! not with npm itself.
2016-03-13T00:12:52.734297+00:00 app[web.1]: npm ERR! Tell the author that this
fails on your system:
2016-03-13T00:12:52.734449+00:00 app[web.1]: npm ERR!     node server.js
2016-03-13T00:12:52.734593+00:00 app[web.1]: npm ERR! You can get information on
 how to open an issue for this project with:
2016-03-13T00:12:52.734754+00:00 app[web.1]: npm ERR!     npm bugs clementinejs-
fcc
2016-03-13T00:12:52.734901+00:00 app[web.1]: npm ERR! Or if that isn't available
, you can get their info via:
2016-03-13T00:12:52.735055+00:00 app[web.1]: npm ERR!     npm owner ls clementin
ejs-fcc
2016-03-13T00:12:52.735207+00:00 app[web.1]: npm ERR! There is likely additional
 logging output above.
2016-03-13T00:12:52.739195+00:00 app[web.1]:
2016-03-13T00:12:52.739538+00:00 app[web.1]: npm ERR! Please include the followi
ng file with any support request:
2016-03-13T00:12:52.739681+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-03-13T00:12:52.704158+00:00 heroku[router]: at=error code=H13 desc="Connect
ion closed without response" method=GET path="/" host=meek-fcc-voting.herokuapp.
com request_id=9479851e-9188-48c2-a73f-f5e27f36e002 fwd="151.229.234.60" dyno=we
b.1 connect=0ms service=39ms status=503 bytes=0
2016-03-13T00:12:53.331859+00:00 heroku[web.1]: State changed from crashed to st
arting
2016-03-13T00:12:53.330847+00:00 heroku[web.1]: State changed from up to crashed

2016-03-13T00:12:53.346439+00:00 heroku[web.1]: Process exited with status 1
2016-03-13T00:12:54.744232+00:00 heroku[web.1]: Starting process with command `n
pm start`
2016-03-13T00:12:57.384566+00:00 app[web.1]:
2016-03-13T00:12:57.384587+00:00 app[web.1]: > clementinejs-fcc@1.0.1 start /app

2016-03-13T00:12:57.384588+00:00 app[web.1]: > node server.js
2016-03-13T00:12:57.384589+00:00 app[web.1]:
2016-03-13T00:12:57.870106+00:00 app[web.1]: { [Error: ENOENT: no such file or d
irectory, open '.env'] errno: -2, code: 'ENOENT', syscall: 'open', path: '.env'
}
2016-03-13T00:12:57.898861+00:00 app[web.1]: Node.js listening on port 36707...
2016-03-13T00:12:58.404112+00:00 heroku[web.1]: State changed from starting to u
p
2016-03-13T00:13:02.175651+00:00 heroku[router]: at=info method=GET path="/favic
on.ico" host=meek-fcc-voting.herokuapp.com request_id=feb309ee-11e8-438c-bcdd-18
60b331cfa8 fwd="151.229.234.60" dyno=web.1 connect=5000ms service=35ms status=30
2 bytes=212
2016-03-13T00:13:02.315106+00:00 app[web.1]:
2016-03-13T00:13:02.315160+00:00 app[web.1]: /app/node_modules/mongodb/lib/serve
r.js:242
2016-03-13T00:13:02.315165+00:00 app[web.1]:         process.nextTick(function()
 { throw err; })
2016-03-13T00:13:02.315166+00:00 app[web.1]:
   ^
2016-03-13T00:13:02.315191+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0
.1:27017
2016-03-13T00:13:02.315193+00:00 app[web.1]:     at Object.exports._errnoExcepti
on (util.js:890:11)
2016-03-13T00:13:02.315193+00:00 app[web.1]:     at exports._exceptionWithHostPo
rt (util.js:913:20)
2016-03-13T00:13:02.315204+00:00 app[web.1]:     at TCPConnectWrap.afterConnect
[as oncomplete] (net.js:1057:14)
2016-03-13T00:13:02.326288+00:00 app[web.1]:
2016-03-13T00:13:02.336078+00:00 app[web.1]: npm ERR! Linux 3.13.0-79-generic
2016-03-13T00:13:02.336527+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bi
n/node" "/app/.heroku/node/bin/npm" "start"
2016-03-13T00:13:02.336879+00:00 app[web.1]: npm ERR! node v5.8.0
2016-03-13T00:13:02.337616+00:00 app[web.1]: npm ERR! npm  v3.7.3
2016-03-13T00:13:02.338000+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-03-13T00:13:02.338212+00:00 app[web.1]: npm ERR! clementinejs-fcc@1.0.1 sta
rt: `node server.js`
2016-03-13T00:13:02.338428+00:00 app[web.1]: npm ERR! Exit status 1
2016-03-13T00:13:02.338701+00:00 app[web.1]: npm ERR!
2016-03-13T00:13:02.338916+00:00 app[web.1]: npm ERR! Failed at the clementinejs
-fcc@1.0.1 start script 'node server.js'.
2016-03-13T00:13:02.339076+00:00 app[web.1]: npm ERR! Make sure you have the lat
est version of node.js and npm installed.
2016-03-13T00:13:02.339232+00:00 app[web.1]: npm ERR! If you do, this is most li
kely a problem with the clementinejs-fcc package,
2016-03-13T00:13:02.339647+00:00 app[web.1]: npm ERR! not with npm itself.
2016-03-13T00:13:02.339873+00:00 app[web.1]: npm ERR! Tell the author that this
fails on your system:
2016-03-13T00:13:02.340099+00:00 app[web.1]: npm ERR!     node server.js
2016-03-13T00:13:02.340319+00:00 app[web.1]: npm ERR! You can get information on
 how to open an issue for this project with:
2016-03-13T00:13:02.340932+00:00 app[web.1]: npm ERR!     npm bugs clementinejs-
fcc
2016-03-13T00:13:02.341092+00:00 app[web.1]: npm ERR! Or if that isn't available
, you can get their info via:
2016-03-13T00:13:02.344061+00:00 app[web.1]: npm ERR!     npm owner ls clementin
ejs-fcc
2016-03-13T00:13:02.344238+00:00 app[web.1]: npm ERR! There is likely additional
 logging output above.
2016-03-13T00:13:02.349176+00:00 app[web.1]:
2016-03-13T00:13:02.349587+00:00 app[web.1]: npm ERR! Please include the followi
ng file with any support request:
2016-03-13T00:13:02.349872+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-03-13T00:13:02.335731+00:00 heroku[router]: at=error code=H13 desc="Connect
ion closed without response" method=GET path="/" host=meek-fcc-voting.herokuapp.
com request_id=e27992b9-29a9-49f7-ad05-c8b5fb610c3e fwd="151.229.234.60" dyno=we
b.1 connect=1ms service=43ms status=503 bytes=0
2016-03-13T00:13:03.171457+00:00 heroku[web.1]: Process exited with status 1
2016-03-13T00:13:03.188703+00:00 heroku[web.1]: State changed from up to crashed

2016-03-13T00:14:24.503648+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=meek-fcc-voting.herokuapp.com request_id=84c9f8a2
-2c33-4bcb-9a73-2a438b50700a fwd="151.229.234.60" dyno= connect= service= status
=503 bytes=
2016-03-13T00:14:24.879521+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=meek-fcc-voting.herokuapp.com request_
id=7d863bd0-4287-477f-b815-9528c9ee16ac fwd="151.229.234.60" dyno= connect= serv
ice= status=503 bytes=

它提到了一个npm调试日志,但我不知道在哪里可以找到它。它不在项目的app目录中。

我试图heroku restart没有运气。如果你知道我错过了什么,我非常感谢任何帮助。

编辑: 我的配置变量是

APP_URL=https://meek-fcc-voting.herokuapp.com/
MONGO_URI=mongodb://localhost:27017/

1 个答案:

答案 0 :(得分:2)

您需要在Heroku上设置环境变量。您可以通过命令行或“设置”页面执行此操作。您还可以使用Heroku AddOns为您设置MongoDB,它会自动添加用于连接它的环境变量。

相关问题