當我部署的應用程序,並從本教程炒高代碼: http://blog.superpat.com/2011/06/14/node-js-chat-demo-on-heroku/Heroku App根據日誌不斷崩潰...爲什麼?
我從Heroku的收到此錯誤: 「在應用程序中出現錯誤,你的頁面無法送達,請再試一次在幾分鐘的時間。
如果您是應用所有者,請檢查您的日誌的詳細信息「。
這裏是我得到的日誌錯誤:
2013-05-07T12:46:21.537628+00:00 app[web.1]: module.js:340
2013-05-07T12:46:21.537946+00:00 app[web.1]: throw err;
2013-05-07T12:46:21.538118+00:00 app[web.1]: ^
2013-05-07T12:46:21.540143+00:00 app[web.1]: Error: Cannot find module 'pg'
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:338:15)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at require (module.js:380:17)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:22:10)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Module._compile (module.js:456:26)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Module.load (module.js:356:32)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Module.require (module.js:364:17)
2013-05-07T12:46:21.540462+00:00 app[web.1]: at Function.Module.runMain (module.js:497:10)
2013-05-07T12:46:21.540143+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2013-05-07T12:46:22.755998+00:00 heroku[web.1]: Process exited with status 8
2013-05-07T12:47:21.212523+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=nodechatclient.herokuapp.com fwd="72.229.150.213" dyno= connect= service= status=503 bytes=
2013-05-07T12:47:22.593111+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=nodechatclient.herokuapp.com fwd="72.229.150.213" dyno= connect= service= status=503 bytes=
我跟着從教程github上的所有代碼。
什麼可能導致它?它與pg有什麼關係?我是否應該在某處更改數據庫路徑?
當我嘗試在本地使用節點server.js運行它,但我得到這個錯誤:
Error: Cannot find module '/home/euridice/node_modules/pg/lib/native/../../build/default/binding'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/euridice/node_modules/pg/lib/native/index.js:16:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
這是什麼意思?
編輯:修正了一些東西,現在我越來越:
events.js:72
throw er; // Unhandled 'error' event
^
Error: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
at Connection.<anonymous> (/home/euridice/node_chat/node_modules/pg/lib/native/index.js:187:17)
at Connection.EventEmitter.emit (events.js:95:17)
這聞起來像你沒有一個安裝在你的應用程序依賴的PG模塊。 – 2013-05-07 13:45:33
作爲後續步驟,將持久性添加到聊天服務器。你是否在package.json文件中添加了一個postgres作爲依賴項?還有就是如何在原始博客文章做到這一點後來一個例子,雖然我建議使用Postgres的1.1.0版本(而不是在博客中給出的0.5版本)。謝謝 – jr0cket 2013-05-07 15:43:11
@ JR0cket,不,我沒有。我想我會注意它。看我的編輯。我在哪裏可以找到將postgres添加爲依賴項的說明?我找不到它。 – 2013-05-07 18:48:20