Failed to load c++ bson extension
I guess you did not have the make tools available when you installed your mongodb library. I suggest you do
xcode-select --install
(on a mac)or sudo apt-get install gcc make build-essential
(on ubuntu)
and run
rm -rf node_modulesnpm cache cleannpm install
OR just npm update based on @tobias comment (after installing build-essential)
npm update
I just resolved that.
When you install the mongoose module by npm, it does not have a built bson module in it's folder. In the file node_modules/mongoose/node_modules/mongodb/node_modules/bson/ext/index.js
, change the line
bson = require('../build/Release/bson');
to
bson = require('bson');
and then install the bson module using npm.
I have sorted the issue of getting the "Failed to load c++ bson extension" on raspbian(debian for raspberry) by:
npm install -g node-gyp
and then
npm update