scotch-io / starter-node-angular

A starter kit for Node and Angular Single Page Apps
http://scotch.io/bar-talk/setting-up-a-mean-stack-single-page-application
477 stars 1.44k forks source link

Cannot connect to local DB #2

Open petre2dor opened 10 years ago

petre2dor commented 10 years ago

db.js contains: module.exports = { url : 'mongodb://localhost/test' }

and I have mongodb installed: $ mongo --version MongoDB shell version: 2.4.6 when is start node server.js I get this: connect.multipart() will be removed in connect 3.0 visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives connect.limit() will be removed in connect 3.0 The magic happens on port 8080 events.js:72 throw er; // Unhandled 'error' event ^ Error: failed to connect to [localhost:27017] at null.<anonymous> (/home/petre/Documents/work/starter-node-angular/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:553:74) at EventEmitter.emit (events.js:106:17) at null.<anonymous> (/home/petre/Documents/work/starter-node-angular/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15) at EventEmitter.emit (events.js:98:17) at Socket.<anonymous> (/home/petre/Documents/work/starter-node-angular/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:512:10) at Socket.EventEmitter.emit (events.js:95:17) at net.js:440:14 at process._tickCallback (node.js:415:13)

What am I missing?

Thanks for the tutorial and the project! Petre

mattwarren1234 commented 10 years ago

I ran into the same problem initially! Before starting node, go to the top level directory of your project and type mongod then run node server.js. My bet is that it is trying to connect to mongo but mongo is not yet running.