Node.js 部署应用程序Sails js Heroku |应用程序错误
我运行应用程序时出错 应用程序错误。 应用程序中出现错误,无法提供您的页面。请稍后再试 如果您是应用程序所有者,请查看日志以了解详细信息 Heroku日志:Node.js 部署应用程序Sails js Heroku |应用程序错误,node.js,heroku,sails.js,mlab,sails-mongo,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 in
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=
有人能帮我吗?我不知道该怎么解决这个问题 根据您的评论,您的问题是sails有时会混淆多个名称适配器。下面还概述了您的问题和解决方案
MongoDB在heroku上不是免费的,您要付费的吗?如果是,您可能需要为Connexion设置凭据信息如果您在适配器配置中看到,我将一个Env变量设置为mongonab。heroku允许您创建一个自由实例@jaumardmake确保Mongodab_URI正确,尝试通过您的控制台连接MongodbHerokuServer唯一定义的适配器?没有,但当我尝试删除生成默认SAIL的其他适配器时,我的应用程序运行了。谢谢你@Meeker感谢链接Meeker,此解决方案对我有效:
MongodbHerokuServer: {
adapter: 'sails-mongo',
url: process.env.MONGOLAB_URI
},