部署App Sails js Heroku |应用程序错误

时间:2015-05-05 15:33:09

标签: node.js heroku sails.js mlab sails-mongo

运行我的应用时出错。

应用程序错误。 应用程序中发生错误,无法提供您的页面。请稍后再试。

如果您是应用程序所有者,请查看日志以获取详细信息。

Heroku记录:

   May 05 08:17:00 game  app/web.1:  > node app.js 
May 05 08:17:04 game  app/web.1:  error: Error: Failed to connect to MongoDB.  Are you sure your configured Mongo instance is running? 
May 05 08:17:04 game  app/web.1:   Error details: 
May 05 08:17:04 game  app/web.1:  { [MongoError: connect ECONNREFUSED] name: 'MongoError', message: 'connect ECONNREFUSED' } 
May 05 08:17:04 game  app/web.1:      at _createError (/app/node_modules/sails-mongo/lib/adapter.js:101:23) 
May 05 08:17:04 game  app/web.1:      at /app/node_modules/sails-mongo/lib/adapter.js:104:13 
May 05 08:17:04 game  app/web.1:      at /app/node_modules/sails-mongo/lib/connection.js:25:20 
May 05 08:17:04 game  app/web.1:      at /app/node_modules/sails-mongo/node_modules/mongodb/lib/mongo_client.js:236:20 
May 05 08:17:04 game  app/web.1:      at /app/node_modules/sails-mongo/node_modules/mongodb/lib/db.js:197:14 
May 05 08:17:04 game  app/web.1:      at null.<anonymous> (/app/node_modules/sails-mongo/node_modules/mongodb/lib/server.js:226:9) 
May 05 08:17:04 game  app/web.1:      at g (events.js:199:16) 
May 05 08:17:04 game  app/web.1:      at emit (events.js:110:17) 
May 05 08:17:04 game  app/web.1:      at null.<anonymous> (/app/node_modules/sails-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:239:68) 
May 05 08:17:04 game  app/web.1:      at g (events.js:199:16) 
May 05 08:17:04 game  app/web.1:      at emit (events.js:110:17) 
May 05 08:17:04 game  app/web.1:      at null.<anonymous> (/app/node_modules/sails-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:77:12) 
May 05 08:17:04 game  app/web.1:      at g (events.js:199:16) 
May 05 08:17:04 game  app/web.1:      at emit (events.js:110:17) 
May 05 08:17:04 game  app/web.1:      at Socket.<anonymous> (/app/node_modules/sails-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:118:49) 
May 05 08:17:04 game  app/web.1:      at Socket.g (events.js:199:16) { [Error: Failed to connect to MongoDB.  Are you sure your configured Mongo instance is running? 
May 05 08:17:04 game  app/web.1:   Error details: 
May 05 08:17:04 game  app/web.1:  { [MongoError: connect ECONNREFUSED] name: 'MongoError', message: 'connect ECONNREFUSED' }] 
May 05 08:17:04 game  app/web.1:    originalError: { [MongoError: connect ECONNREFUSED] name: 'MongoError', message: 'connect ECONNREFUSED' } } 
May 05 08:17:04 game  app/web.1:  /app/node_modules/sails-mongo/node_modules/mongodb/lib/mongo_client.js:385 
May 05 08:17:04 game  app/web.1:                throw err 
May 05 08:17:04 game  app/web.1:                      ^ 
May 05 08:17:04 game  app/web.1:  TypeError: Cannot set property 'connection' of undefined 
May 05 08:17:04 game  app/web.1:      at /app/node_modules/sails-mongo/lib/adapter.js:106:53 
May 05 08:17:04 game  app/web.1:  npm ERR! Linux 3.13.0-49-generic 
May 05 08:17:04 game  app/web.1:  npm ERR! code ELIFECYCLE 
May 05 08:17:04 game  app/web.1:  npm ERR! gameMouseCat@0.0.0 start: `node app.js` 
May 05 08:17:04 game  app/web.1:  npm ERR! Exit status 1 
May 05 08:17:04 game  app/web.1:  npm ERR!  
May 05 08:17:04 game  app/web.1:  npm ERR! Failed at the gameMouseCat@0.0.0 start script 'node app.js'. 
May 05 08:17:04 game  app/web.1:  npm ERR! This is most likely a problem with the gameMouseCat package, 
May 05 08:17:04 game  app/web.1:  npm ERR! not with npm itself. 
May 05 08:17:04 game  app/web.1:  npm ERR! Tell the author that this fails on your system: 
May 05 08:17:04 game  app/web.1:  npm ERR!     node app.js 
May 05 08:17:04 game  app/web.1:      at /app/node_modules/sails-mongo/lib/connection.js:31:5 
May 05 08:17:04 game  app/web.1:      at /app/node_modules/sails-mongo/node_modules/mongodb/lib/mongo_client.js:382:15 
May 05 08:17:04 game  app/web.1:      at process._tickDomainCallback (node.js:381:11) 
May 05 08:17:04 game  app/web.1:  npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start" 
May 05 08:17:04 game  app/web.1:  npm ERR! node v0.12.2 
May 05 08:17:04 game  app/web.1:  npm ERR! npm  v2.7.4 
May 05 08:17:04 game  app/web.1:  npm ERR! Please include the following file with any support request: 
May 05 08:17:04 game  app/web.1:  npm ERR!     /app/npm-debug.log 
May 05 08:17:04 game  app/web.1:  npm ERR! You can get their info via: 
May 05 08:17:04 game  app/web.1:  npm ERR!     npm owner ls gameMouseCat 
May 05 08:17:04 game  app/web.1:  npm ERR! There is likely additional logging output above. 
May 05 08:17:05 game  heroku/web.1:  State changed from starting to crashed 
May 05 08:17:05 game  heroku/web.1:  Process exited with status 1 
May 05 08:19:38 game  heroku/router:  at=error code=H10 desc="App crashed" method=GET path="/" host=game .herokuapp.com request_id=5c4b7249-ad10-492d-acd0-efb4fbd314ed fwd="207.244.77.3" dyno= connect= service= status=503 bytes= 
May 05 08:19:56 game  heroku/router:  at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=game .herokuapp.com request_id=9678ba10-05ea-4a38-806f-12565e0ded63 fwd="207.244.77.3" dyno= connect= service= status=503 bytes= 

适配器配置:

MongodbHerokuServer: {
    adapter: 'sails-mongo',
    url: process.env.MONGOLAB_URI
  },

任何人都可以帮助我吗?我不知道如何解决这个问题。

1 个答案:

答案 0 :(得分:5)

根据评论你的问题是,有时风帆会混淆多个名称适配器。您的问题和解决方案也在下面列出。

https://github.com/balderdashy/sails/issues/939

sailsjs still uses default database after changing it to mongodb

Handling database environment configuration in Sails.js