js-bson: Failed to load c++ bson extension, using pure JS version js-bson: Failed to load c++ bson extension, using pure JS version mongodb mongodb

js-bson: Failed to load c++ bson extension, using pure JS version


I guess you did not have the make tools available when you installed your mongodb library. I suggest you do
Mac:

xcode-select --install 

Ubuntu:

sudo apt-get install gcc make build-essential 

and run

rm -rf node_modulesnpm cache cleannpm install

You need python 2 for it to compile. If your path to python is for python 3 then do this :

npm config -g set python "/usr/bin/python2"

The 'EACCES` error means the program did not have enough privileges to do what is trying to.

From what I read about groups here, you need to add the user to the group wheel. Use this command :

gpasswd -a [user] [group]

Follow the link for a detailed understanding of groups and users.


Unfortunately, All the above answers are only half right.. Took a long time to figure this out..

Mongoose bson install via npm throws warning and causes the error...

npm install -g node-gypgit clone https://github.com/mongodb/js-bson.gitcd js-bsonnpm installnode-gyp rebuild

This works like magic!!


on ubuntu 14.04 I needed to create a link in /usr/bin because /usr/bin/env was looking for /usr/bin/node

ln -s /usr/bin/nodejs /usr/bin/node

The error messages can be found in the builderror.log in each directory so for the message:

bson@0.2.21 install /usr/local/lib/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson (node-gyp rebuild 2> builderror.log) || (exit 0)look at this file for more information about the exact problem

/usr/local/lib/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/builderror.log