Failed to Load C++ Bson Extension

Failed to load C++ bson extension, using pure JS version error when running mongodb-backed node app

You are depending on an old version of mongodb which in turn is depending on an old version of bson which probably lacks (complete) support for node v0.12+.

The current version of mongodb is 2.0.33 as of this writing. Try using that instead and it should work fine.

On an unrelated note, the version of Express you're depending on (3.x) is old too, 4.x has been out for quite some time now.

Getting failed to load c++ bson extension error using Mongodb and Node.js

Since you're using the mongojs module, you're going to have to connect to the database using the following method

db = mongo("127.0.0.1:27017/"+db, collections);

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_modules
npm cache clean
npm 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.

Failed to load c++ bson extension, using pure JS version -- no mongoose, no express, just node driver

I think the error is pretty clear: Error: "pre" versions of node cannot be installed, use the --nodedir flag instead. So you should either supply the path to the root node source directory that you installed node from or install/use an actual node release (v0.11.13 is the latest unstable release and v0.10.29 is the latest stable release as of this writing) and try npm install/node-gyp rebuild again.

The reason it asks for the node source directory is because node-gyp has to download a node source tarball from the nodejs.org site to be able to compile addons (it needs the C++ header files, etc). However if you have a node version that is a pre-release, node-gyp has no way to know what source tree to download in order to match what you have installed.



Related Topics



Leave a reply



Submit