2015-05-05 2 views
4

У меня ошибка при запуске моего приложения.Развертывание приложений Sails js Heroku | Ошибка приложения

Ошибка приложения. Произошла ошибка в приложении, и ваша страница не могла быть отправлена. Пожалуйста, попробуйте снова через пару минут.

Если вы являетесь владельцем приложения, проверьте свои журналы.

Журналы 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! [email protected] 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 [email protected] 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 
    }, 

Может кто-нибудь мне помочь? Я не знаю, что делать, чтобы решить эту проблему.

+0

MongoDB не свободны от Heroku вы взять платный? Если да, возможно, вам нужно установить данные учетных данных для связи – jaumard

+0

Если вы видите в конфигурации адаптера, я помещаю переменную Env из MONGOLAB. heroku позволяет создать бесплатный экземпляр mongolab. @jaumard –

+0

убедитесь, что MONGOLAB_URI верен, попробуйте подключиться через консоль. – Meeker

ответ

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

+0

Спасибо за ссылку Meeker, это решение сработало для меня: https://github.com/balderdashy/sails/issues/939#issuecomment-75263524 – ccurtisj