Search code examples
node.jsmongodbbson

Cannot find module '../build/Release/bson'. NodeJS


I have a very big problem. I have a usual dependencies in my package.json:

"dependencies": {
"express": "*",
"ect": "*",
"express-session": "*",
"mongodb": "*",
"passport" : "*",
"passport-facebook": "*",
"passport-vkontakte": "*",
"passport-google-oauth": "*",
"passport-twitter": "*",
"debug" : "*"
}

But after successful npm install, i see this:

$ sudo npm start

> nodejs ./bin/www

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version

I've read related questions on Stack Overflow, but they did not help me.

I spent a lot of time to fix it, but it is not repaired.

OS: Ubuntu 15.05 Node version: v0.10.25 NPM version: 1.4.21

Thank you.


Solution

  • Hello to all who find this topic in google :)

    I solved this problem.

    Ubuntu package node called nodejs instead node. That because build scripts bson not work. Therefore, the problem is easily solved:

    $ cd node_modules/bson/node_modules/bson-ext
    $ ln -s /usr/bin/nodejs node
    $ export PATH=$PATH:.
    $ make