{"id":219,"hash":"1f32f35af49b3ce7d06c510c8412b90eef44bca14c336e35bcd6aa693fc0caf6","pattern":"Failed to load c++ bson extension","full_message":"A total node noob here. I've been trying to set up a sample node app but the following error keeps popping up every time I try to run:\n\n  node app\n\nFailed to load c++ bson extension, using pure JS version\n\nevents.js:72\n        throw er; // Unhandled 'error' event\n              ^\nError: failed to connect to [#$%67890 :27017]\n    at null.<anonymous> (/home/thejazeto/code/nodejs/authen/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:553:74)\n    at EventEmitter.emit (events.js:106:17)\n    at null.<anonymous> (/home/thejazeto/code/nodejs/authen/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)\n    at EventEmitter.emit (events.js:98:17)\n    at Socket.<anonymous> (/home/thejazeto/code/nodejs/authen/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:512:10)\n    at Socket.EventEmitter.emit (events.js:95:17)\n    at net.js:830:16\n    at process._tickCallback (node.js:415:13)","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"I guess you did not have the make tools available when you installed your mongodb library. I suggest you do \n\nxcode-select --install (on a mac)\nor sudo apt-get install gcc make build-essential (on ubuntu)\n\nand run \n\nrm -rf node_modules\nnpm cache clean\nnpm install\n\nOR just npm update based on @tobias comment (after installing build-essential)\n\nnpm update","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/21656420/failed-to-load-c-bson-extension","votes":187,"created_at":"2026-04-19T04:41:32.697227+00:00","updated_at":"2026-04-19T04:51:30.403203+00:00"}