mongodb - Getting Node.js up and running - DB connection errors -
i'm super new node.js, basic question, happening when console telling me
error: unable connect database @ mongodb://localhost/realjoet-me-development
i'm running environment using swig, sass, node, express, gulp, nodemon , yeoman.
i have db set on heroku mongolab add-on.
what causing error causes app crash can't view on localhost??
what more need know better understand situation??
here's entire console log
➜ realjoet.me git:(master) ✗ gulp [06:50:13] using gulpfile ~/sites/realjoet.me/gulpfile.js [06:50:13] starting 'sass'... [06:50:13] starting 'develop'... [06:50:13] finished 'develop' after 6.51 ms [06:50:13] starting 'watch'... [06:50:13] finished 'watch' after 9.09 ms [06:50:13] [nodemon] 1.8.0 [06:50:13] [nodemon] restart @ time, enter `rs` [06:50:13] [nodemon] watching: *.* [06:50:13] [nodemon] starting `node app.js` [06:50:13] /users/realjoet/sites/realjoet.me/public/css/style.css reloaded. [06:50:13] finished 'sass' after 243 ms [06:50:13] starting 'default'... [06:50:13] finished 'default' after 4.09 μs [06:50:14] /users/realjoet/sites/realjoet.me reloaded. express server listening on port 3000 /users/realjoet/sites/realjoet.me/node_modules/mongodb/lib/server.js:235 process.nexttick(function() { throw err; }) ^ error: unable connect database @ mongodb://localhost/realjoet-me-development @ nativeconnection.<anonymous> (/users/realjoet/sites/realjoet.me/app.js:11:9) @ nativeconnection.emit (events.js:107:17) @ nativeconnection.connection.error (/users/realjoet/sites/realjoet.me/node_modules/mongoose/lib/connection.js:425:8) @ /users/realjoet/sites/realjoet.me/node_modules/mongoose/lib/connection.js:452:14 @ /users/realjoet/sites/realjoet.me/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:52:21 @ /users/realjoet/sites/realjoet.me/node_modules/mongodb/lib/db.js:226:14 @ null.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb/lib/server.js:233:9) @ g (events.js:199:16) @ emit (events.js:110:17) @ null.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb-core/lib/topologies/server.js:263:68) @ g (events.js:199:16) @ emit (events.js:110:17) @ null.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb-core/lib/connection/pool.js:77:12) @ g (events.js:199:16) @ emit (events.js:110:17) @ socket.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb-core/lib/connection/connection.js:121:49) [06:50:14] [nodemon] app crashed - waiting file changes before starting... [06:50:27] [nodemon] restarting due changes... [06:50:27] [nodemon] starting `node app.js` [06:50:28] /users/realjoet/sites/realjoet.me reloaded. express server listening on port 3000 /users/realjoet/sites/realjoet.me/node_modules/mongodb/lib/server.js:235 process.nexttick(function() { throw err; }) ^ error: unable connect database @ mongodb://localhost/realjoet-me-development @ nativeconnection.<anonymous> (/users/realjoet/sites/realjoet.me/app.js:11:9) @ nativeconnection.emit (events.js:107:17) @ nativeconnection.connection.error (/users/realjoet/sites/realjoet.me/node_modules/mongoose/lib/connection.js:425:8) @ /users/realjoet/sites/realjoet.me/node_modules/mongoose/lib/connection.js:452:14 @ /users/realjoet/sites/realjoet.me/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:52:21 @ /users/realjoet/sites/realjoet.me/node_modules/mongodb/lib/db.js:226:14 @ null.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb/lib/server.js:233:9) @ g (events.js:199:16) @ emit (events.js:110:17) @ null.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb-core/lib/topologies/server.js:263:68) @ g (events.js:199:16) @ emit (events.js:110:17) @ null.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb-core/lib/connection/pool.js:77:12) @ g (events.js:199:16) @ emit (events.js:110:17) @ socket.<anonymous> (/users/realjoet/sites/realjoet.me/node_modules/mongodb-core/lib/connection/connection.js:121:49) [06:50:28] [nodemon] app crashed - waiting file changes before starting...
you should have mongodb uri mongolab database need use in application. check out tutorial: https://devcenter.heroku.com/articles/mongolab#connecting-to-existing-mongolab-deployments-from-heroku
and you'll need point mongodb orm you're using in node.js application mongodb uri.
best.
Comments
Post a Comment