app.js connection to mongodb

in my server, I put a nodejs file called app.js and will run from the console on a ubuntu server, but I get this error which I have put the errors below.

I've tried node-gyp rebuild and it will still not work but get error during update:

gyp ERR! configure error gyp ERR! Stack Error: gyp failed with exit code: 1 gyp ERR! stack to ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:343:16) gyp ERR! stack to ChildProcess.emit (events.js: 98: 17) gyp ERR! stack to Process.ChildProcess._handle.onexit (child_process.js: 810: 12) gyp ERR! System Linux 3.2.0-37-virtual gyp ERR! command "node" "/ usr / bin / node-gyp" "rebuild" gyp ERR! CWD / root gyp ERR! node -v v0.10.31 gyp ERR! node-gyp -v v1.0.2 gyp ERR! not ok

root@server1:~# node app.js js-bson: Failed to load c++ bson extension, using pure JS version

/root/node_modules/mongodb/lib/mongodb/mongo_client.js:409 throw err ^ Error: failed to connect to [198.187.30.124:27017] at null. (/root/node_modules/mongodb/lib/mongodb/connection/serve r.js:546:74) at emit (events.js:106:17) at null. (/root/node_modules/mongodb/lib/mongodb/connection/conne ction_pool.js:150:15) at emit (events.js:98:17) at Socket. (/root/node_modules/mongodb/lib/mongodb/connection/con nection.js:533:10) at Socket.emit (events.js:95:17) at net.js:440:14 at process._tickCallback (node.js:419:13)