i running project on localhost using node , mongodb, fails error try create collection on database.
i building project script:
cd ~/meteor/daily-reminder meteor build ~/build-output-daily-reminder --server=http://localhost cd ~/build-output-daily-reminder tar -xvzf daily-reminder.tar.gz rm daily-reminder.tar.gz cd ~/build-output-daily-reminder/bundle (cd programs/server && npm install) export mongo_url='mongodb://username:password@http://localhost:27017/daily-reminder' export root_url='http://localhost/' export port='3000' echo "now run node main.js" node main.js (i use actual mongodb username , password in real code).
the project builds fine, node won't run. generates error:
now run node main.js /home/shelagh/build-output-daily-reminder/bundle/programs/server/node_modules/fibers/future.js:245 throw(ex); ^ rangeerror: port should >= 0 , < 65536: nan @ socket.connect (net.js:917:13) @ object.exports.connect.exports.createconnection (net.js:92:35) @ [object object].connection.start (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:173:29) @ _connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:211:16) @ [object object].connectionpool.start (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:231:3) @ server.connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/server.js:708:18) @ db.open (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/db.js:281:23) @ connectfunction (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/mongo_client.js:275:67) @ function.mongoclient.connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/mongo_client.js:345:5) @ function.db.connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/db.js:2094:23) if use newly-created meteor project node runs ok. fails add line start of js file:
tasks = new mongo.collection("tasks"); it seems there problem server tries communicate database. can't see wrong mongo_url: port specified 27017. error, looks port isn't being passed in.
i using node v0.12.7 , mongodb shell version: 2.4.9. have started mongo typing 'mongo' in separate terminal window.
your mongo_url wrong, redefines protocol specify host.
change
export mongo_url='mongodb://username:password@http://localhost:27017/daily-reminder' to
export mongo_url='mongodb://username:password@localhost:27017/daily-reminder'
Comments
Post a Comment