0

I have the same issue as a lot of people with nodejs/mongodb/express.

I'm using ubuntu 14.04 on virtual box 4.3.12. Nodejs is v4.2.6 and npm 2.4.12.

The issue is described here : Failed to load c++ bson extension

I did manage to get the error out (by making sure I had build essentials, removing node_modules and installing again).

However, to do so I have to type "sudo npm start".

When I type "npm start", I get the lovely :

[Error: Module did not self-register.]
js-bson: Failed to load c++ bson extension, using pure JS version

I understand what sudo means, but I don't understand why it would get the error out.

I've been battling against this issue for hours and I just want to make sure that the error is indeed gone instead of being hidden in some way by sudo. (I am a beginner in linux and nodejs, so bear with my stupid questions).

Thank you for your time.

Community
  • 1
  • 1

1 Answers1

0

Most likely you have two copies of node installed which are different "major" versions (e.g. 4.x and 5.x, or 0.10 and 4.x, etc.). You can verify this by comparing the output of node -v and sudo node -v.

Many times when "major" versions change like this, the ABI changes as well, meaning node addons need to be recompiled with the new/different node version in order to work.

mscdex
  • 104,356
  • 15
  • 192
  • 153
  • Thank you for pointing me in the right direction. sudo node -v printed me some 0.12.x version instead of 4.2.6 I uninstalled both versions and cleanly installed 4.2.6. sudo node -v now prints me 4.2.6, but the original issue is back unfortunately ! I will sleep on it and see if I can find a way to make it work. – Stephane Leveugle Feb 06 '16 at 20:17