Fix "Failed to Load C++ Bson Extension ..." for Node.js + MongoDB

| Comments

When I deployed my Node.js + MongoDB application on my test server, I met “Failed to load c++ bson extension, using pure JS version”. Even with the pure JS mongo driver the application works, but I still want to fix it.

After google, I got following method to fix my problem:

1. Install build-essential package:

1
  sudo apt-get install build-essential

2. Remove the mongodb module related node modules in node_modules, such as connect-mongo, mongoose

1
  $ rm -rf node_modules/connect-mongo node_modules/mongoose

3. Re-install the mongodb module related node modules

1
  $ npm install

Comments