Remove Failed to load c++ bson extension message from MEAN.js application start

I have previously posted a How To:  install mean.js on ubuntu, In this post I will provide additional instructions on how to remove the error messages that may be displayed  when using Grunt to run your applications.

Once you have successfully completed the installation instructions contained in my previous posts  it may be possible you see error messages similar to the ones below:

This error is generally results from when installing the Mongoose Module via the Node Package Manager (npm) it does not build the BSON module in the folder.  We will need to do this ourselves manually.

Build Essentials Linux

Open terminal window (Ctrl+Alt + T ) and navigate to your project directory, or if you’re like me an you use Webstorm – The smartest JavaScript IDE you can open a terminal window with (Alt+F12 ) , and execute the following line

Once that is complete, ensure you are in the root of project folder and execute the following lines;

** Depending on your set up you may need to run these commands with super user account privileges i.e. sudo

Essentially we will delete the node_modules folder in the project root, clean the cache and then re-create the folder and modules with the correct references.

This will clear up error messages and you should now be able to continue without the nagging doubt that something is wrong with your application.

Build Essentials Windows

Since I published this post, I have noticed a number of visits from users on windows based machines and a comment from a windows user asking about a windows solution.

I must confess to the fact that I have not done any node & mongodb development using windows, and therefore I cannot attest that the following solution will work.  The following solution is entirely based on advice provided by Christian Kvalheim’s blog post , Diagnosing driver installation problems

Open visual studio command prompt. Ensure node.exe is in your path and install node-gyp.

Next you will have to build the project manually to test it. Use any tool you use with git and grab the repo.

Calvin is currently working on a fix to completely remove this conflict but due to some considerable technical challenges this may take some time.

Recommended reading
[amazon template=iframe image&asin=1449344682]
[amazon template=iframe image&asin=1491949309]
[amazon template=iframe image&asin=1782168192]
If you have any further questions please ask in the comments section below or contact me and I will endeavour to respond as soon as I can.

Gary Woodfine

Freelance Full Stack Developer at
Helps businesses by improving their technical proficiencies and eliminating waste from the software development pipelines.

A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.

Latest posts by Gary Woodfine (see all)