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.
  • Slip

    So what about Windows user? i had this error “Failed to load c++ bson extensionW in meanjs too

  • There must a powershell equivalent command you can run. I don’t really know what will work on windows.
    Are you using Webstorm as your IDE?

  • jomogolfer

    I’m on Windows and scoured the internet looking for a solution to this problem. Your solutions worked! Thank you and cheers!!!

    • Thanks dude for the feedback! Awesome to know that it is helping folks 🙂

  • Felipe Siqueira

    Congratulations… I had this problem a long time and I don’t knew the solution… Thank you very much

    • Hey thank you so much for the comment! Really awesome to know I actually helped folks! 🙂

  • Dingus Khan

    What about Mac?

    • I don’t use a mac to develop on. So I don’t really know. I would assume though that Mac being an almost linux based OS the instructions may be similar to the linux instructions. This is only based on my experience that some mac based instructions I’ve seen for other solutions have worked on my linux box 🙂

    • Hi,
      I don’t particularly use Mac all the often, I did do an article about setting up my Mac book,

      When I carried out that process I never had a problem. I would assume following the linux based process for Mac would work.