js-bson: Failed to load c++ bson extension, using pure JS version #2285

Closed
xpepermint opened this Issue Sep 7, 2014 · 115 comments

Comments

Projects
None yet
@xpepermint

I clicked on Fork, cloned the repo and I attached this module to my project. I get this error

js-bson: Failed to load c++ bson extension, using pure JS version

nodejs v0.11.13, latest osx. It looks that the problem is with the mongodb module (works with bson 0.2.15).

@xpepermint xpepermint referenced this issue in mongodb/js-bson Sep 7, 2014

Closed

C++ build fails since 0.2.13 #95

@lazdmx

This comment has been minimized.

Show comment
Hide comment
@lazdmx

lazdmx Sep 8, 2014

Same problem

lazdmx commented Sep 8, 2014

Same problem

@bazineta

This comment has been minimized.

Show comment
Hide comment
@bazineta

bazineta Sep 8, 2014

Same issue here; backing off to 3.8.15 resolves the issue on OSX under 0.11.13.

bazineta commented Sep 8, 2014

Same issue here; backing off to 3.8.15 resolves the issue on OSX under 0.11.13.

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Sep 8, 2014

Collaborator

Yeah I've noticed this too. Your code will still work, just you may have worse performance. I'll fix this for next version.

Collaborator

vkarpov15 commented Sep 8, 2014

Yeah I've noticed this too. Your code will still work, just you may have worse performance. I'll fix this for next version.

@vkarpov15 vkarpov15 added this to the 3.8.17 milestone Sep 8, 2014

@xpepermint

This comment has been minimized.

Show comment
Hide comment

ok

@leohidalgo

This comment has been minimized.

Show comment
Hide comment
@leohidalgo

leohidalgo Sep 11, 2014

Same problem

Same problem

@merqlove

This comment has been minimized.

Show comment
Hide comment
@merqlove

merqlove Sep 11, 2014

Same here. Will stay 3.8.15 till changes.

Same here. Will stay 3.8.15 till changes.

@alejonext

This comment has been minimized.

Show comment
Hide comment
@alejonext

alejonext Sep 17, 2014

Ok.... Same problem!

Ok.... Same problem!

@vkarpov15 vkarpov15 modified the milestones: 3.8.18, 3.8.17 Sep 29, 2014

@vkarpov15 vkarpov15 modified the milestones: 3.8.19, 3.8.18 Oct 22, 2014

@rubenstolk

This comment has been minimized.

Show comment
Hide comment
@rubenstolk

rubenstolk Nov 1, 2014

Any update on this?

Any update on this?

@vkarpov15 vkarpov15 assigned alabid and unassigned alabid Nov 7, 2014

@vkarpov15 vkarpov15 modified the milestones: 3.8.20, 3.8.19 Nov 7, 2014

@gas3

This comment has been minimized.

Show comment
Hide comment
@gas3

gas3 Nov 18, 2014

I had the same problem (mongoose 3.8.19 and node 0.10.33). I've just resolve it after noticing that npm install (and npm update) compile the Debug version of bson but index.js (placed in node_modules/mongoose/node_modules/mongodb/node_modules/bson/ext/index.js in my case) require the Release version. As you can see in this section of the code:

try {
    // Load the precompiled win32 binary
    if(process.platform == "win32" && process.arch == "x64") {
      bson = require('./win32/x64/bson');  
    } else if(process.platform == "win32" && process.arch == "ia32") {
      bson = require('./win32/ia32/bson');  
    } else {
      bson = require('../build/Release/bson');  
    }   
} catch(err) {
    // Attempt to load the release bson version
    try {
        bson = require('../build/Release/bson');
    } catch (err) {
        console.error("js-bson: Failed to load c++ bson extension, using pure JS version");
        bson = require('../lib/bson/bson');
    }
}

I went inside the build directory and simply compile bson with the following command

make BUILDTYPE=Release all

Somewhere in the repository it has been changed from Release to Debug, but I didn't search into it.

gas3 commented Nov 18, 2014

I had the same problem (mongoose 3.8.19 and node 0.10.33). I've just resolve it after noticing that npm install (and npm update) compile the Debug version of bson but index.js (placed in node_modules/mongoose/node_modules/mongodb/node_modules/bson/ext/index.js in my case) require the Release version. As you can see in this section of the code:

try {
    // Load the precompiled win32 binary
    if(process.platform == "win32" && process.arch == "x64") {
      bson = require('./win32/x64/bson');  
    } else if(process.platform == "win32" && process.arch == "ia32") {
      bson = require('./win32/ia32/bson');  
    } else {
      bson = require('../build/Release/bson');  
    }   
} catch(err) {
    // Attempt to load the release bson version
    try {
        bson = require('../build/Release/bson');
    } catch (err) {
        console.error("js-bson: Failed to load c++ bson extension, using pure JS version");
        bson = require('../lib/bson/bson');
    }
}

I went inside the build directory and simply compile bson with the following command

make BUILDTYPE=Release all

Somewhere in the repository it has been changed from Release to Debug, but I didn't search into it.

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Nov 21, 2014

Collaborator

@gas3 what version of npm are you using and what platform are you running this on? This really shouldn't be happening in stable node 0.10.x.

Also, I've managed to repro this - looks like a clean npm install with npm 2.0.0 (the version that comes with node 0.11.14) and node 0.11.14 makes this work fine. That is, rm -rf node_modules && npm install. Can y'all check if this helps?

Collaborator

vkarpov15 commented Nov 21, 2014

@gas3 what version of npm are you using and what platform are you running this on? This really shouldn't be happening in stable node 0.10.x.

Also, I've managed to repro this - looks like a clean npm install with npm 2.0.0 (the version that comes with node 0.11.14) and node 0.11.14 makes this work fine. That is, rm -rf node_modules && npm install. Can y'all check if this helps?

@gas3

This comment has been minimized.

Show comment
Hide comment
@gas3

gas3 Nov 23, 2014

npm 2.1.7 on Os X 10.9.5

gas3 commented Nov 23, 2014

npm 2.1.7 on Os X 10.9.5

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Nov 24, 2014

Collaborator

Can you try a clean npm install - kill off node_modules and then npm install? This really sounds like an issue of changing versions of node without rebuilding js-bson.

Collaborator

vkarpov15 commented Nov 24, 2014

Can you try a clean npm install - kill off node_modules and then npm install? This really sounds like an issue of changing versions of node without rebuilding js-bson.

@vkarpov15 vkarpov15 modified the milestones: 3.8.21, 3.8.20 Nov 26, 2014

@vkarpov15 vkarpov15 removed this from the 3.8.21 milestone Dec 18, 2014

@brunowego

This comment has been minimized.

Show comment
Hide comment

+1

@brownman brownman referenced this issue in linnovate/mean Dec 30, 2014

Closed

mongoose: err loading bson #986

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Jan 2, 2015

Collaborator

@brunobatista try rm -rf on your node_modules and do a clean npm install.

Collaborator

vkarpov15 commented Jan 2, 2015

@brunobatista try rm -rf on your node_modules and do a clean npm install.

@Tyvain

This comment has been minimized.

Show comment
Hide comment
@Tyvain

Tyvain Jan 8, 2015

Same problem:
node version: v0.10.35
npm version: 2.1.18

Tyvain commented Jan 8, 2015

Same problem:
node version: v0.10.35
npm version: 2.1.18

@fsanzv

This comment has been minimized.

Show comment
Hide comment
@fsanzv

fsanzv Jan 13, 2015

Same problem here:
OS: Arch Linux
Node version: v0.10.35
npm version: 2.1.18
Mongoose version: 3.8.21

Tried 'rm -rf node_modules; npm cache clean; npm install' with no luck.
Tried also with Mongoose version 3.8.15 with same results.

fsanzv commented Jan 13, 2015

Same problem here:
OS: Arch Linux
Node version: v0.10.35
npm version: 2.1.18
Mongoose version: 3.8.21

Tried 'rm -rf node_modules; npm cache clean; npm install' with no luck.
Tried also with Mongoose version 3.8.15 with same results.

@Jokero

This comment has been minimized.

Show comment
Hide comment
@Jokero

Jokero Jan 13, 2015

Contributor

Same issue was on Ubuntu 14.04. My steps:

  1. Updated npm to 2.1.18 from 1.3
  2. npm cache clean
  3. rm -rf node_modules
  4. npm i
    It works!

But I see error on Windows 8.1. This "require" throws error:

bson = require('./win32/ia32/bson'); 
The specified procedure could not be found.
C:\Users\d.kiriliuk\Projects\vozovoz\node_modules\mongoose\node_modules\mongodb\node_modules\bson\ext\win32\ia32\bson.node

File bson.node exists

Contributor

Jokero commented Jan 13, 2015

Same issue was on Ubuntu 14.04. My steps:

  1. Updated npm to 2.1.18 from 1.3
  2. npm cache clean
  3. rm -rf node_modules
  4. npm i
    It works!

But I see error on Windows 8.1. This "require" throws error:

bson = require('./win32/ia32/bson'); 
The specified procedure could not be found.
C:\Users\d.kiriliuk\Projects\vozovoz\node_modules\mongoose\node_modules\mongodb\node_modules\bson\ext\win32\ia32\bson.node

File bson.node exists

@mokesmokes

This comment has been minimized.

Show comment
Hide comment
@mokesmokes

mokesmokes Jan 21, 2015

Plans to fix this?

Plans to fix this?

@luisfontes

This comment has been minimized.

Show comment
Hide comment
@luisfontes

luisfontes Jan 28, 2015

Same problem

OS: OSX 10.10.2
Node version: v0.10.36
npm version: 2.3.0
Mongoose version: 3.8.22

Tried 'rm -rf node_modules; npm cache clean; npm install' with no luck.

When requiring mongoose, I get this output:

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

Same problem

OS: OSX 10.10.2
Node version: v0.10.36
npm version: 2.3.0
Mongoose version: 3.8.22

Tried 'rm -rf node_modules; npm cache clean; npm install' with no luck.

When requiring mongoose, I get this output:

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

This comment has been minimized.

Show comment
Hide comment

danil-z commented Jan 29, 2015

+1

@arefm

This comment has been minimized.

Show comment
Hide comment
@arefm

arefm Feb 20, 2015

Same Problem!!

OS: UBUNTU 14.04 (x64)
node version: 0.12.0
npm version: 2.5.1
mongoose version: 3.8.21

[Error: node_modules/mongoose/node_modules/mongodb/node_modules/bson/build/Release/bson.node: undefined symbol: node_module_register]

(err): js-bson: Failed to load c++ bson extension, using pure JS version

arefm commented Feb 20, 2015

Same Problem!!

OS: UBUNTU 14.04 (x64)
node version: 0.12.0
npm version: 2.5.1
mongoose version: 3.8.21

[Error: node_modules/mongoose/node_modules/mongodb/node_modules/bson/build/Release/bson.node: undefined symbol: node_module_register]

(err): js-bson: Failed to load c++ bson extension, using pure JS version
@fsanzv

This comment has been minimized.

Show comment
Hide comment
@fsanzv

fsanzv Feb 20, 2015

Any workaround or plans to fix it?

fsanzv commented Feb 20, 2015

Any workaround or plans to fix it?

@arefm

This comment has been minimized.

Show comment
Hide comment
@arefm

arefm Feb 20, 2015

I didn't find anything :(
I try to re-install my packages...
rebuild bson with node-gyp
clean npm cache and ....
nothing happed.
still I got this message

arefm commented Feb 20, 2015

I didn't find anything :(
I try to re-install my packages...
rebuild bson with node-gyp
clean npm cache and ....
nothing happed.
still I got this message

@arefm

This comment has been minimized.

Show comment
Hide comment
@arefm

arefm Feb 20, 2015

I update my mongoose package to 3.9.7
the problem fixed but I got this message from mongoose:

##############################################################
#
#   !!! MONGOOSE WARNING !!!
#
#   This is an UNSTABLE release of Mongoose.
#   Unstable releases are available for preview/testing only.
#   DO NOT run this in production.
#
##############################################################

arefm commented Feb 20, 2015

I update my mongoose package to 3.9.7
the problem fixed but I got this message from mongoose:

##############################################################
#
#   !!! MONGOOSE WARNING !!!
#
#   This is an UNSTABLE release of Mongoose.
#   Unstable releases are available for preview/testing only.
#   DO NOT run this in production.
#
##############################################################

@arefm

This comment has been minimized.

Show comment
Hide comment
@arefm

arefm Feb 20, 2015

FIXED!
I use latest stable version of mongoose (3.8.23)
the problem fixed :)

arefm commented Feb 20, 2015

FIXED!
I use latest stable version of mongoose (3.8.23)
the problem fixed :)

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Feb 20, 2015

Collaborator

"Fixing" this in general isn't really possible, because this error message can mean one of numerous things. It can mean that you don't have a proper version of python or a proper C++ compiler installed (because of node-gyp), it can mean that you switched versions of node from when you npm installed mongoose, etc.

Collaborator

vkarpov15 commented Feb 20, 2015

"Fixing" this in general isn't really possible, because this error message can mean one of numerous things. It can mean that you don't have a proper version of python or a proper C++ compiler installed (because of node-gyp), it can mean that you switched versions of node from when you npm installed mongoose, etc.

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Oct 25, 2015

Collaborator

Not an error, just a warning. Also there's enough information out there / on this thread on how to set up node-gyp properly.

Collaborator

vkarpov15 commented Oct 25, 2015

Not an error, just a warning. Also there's enough information out there / on this thread on how to set up node-gyp properly.

@visionscaper

This comment has been minimized.

Show comment
Hide comment
@visionscaper

visionscaper Oct 25, 2015

@vkarpov15 Thanks for the reply. This is an error, not a warning: npm install fails after this message. Can you tell me more about how this relates to node-gyp.

@vkarpov15 Thanks for the reply. This is an error, not a warning: npm install fails after this message. Can you tell me more about how this relates to node-gyp.

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Oct 26, 2015

Collaborator

npm install doesn't output this message, so I highly doubt that.

Collaborator

vkarpov15 commented Oct 26, 2015

npm install doesn't output this message, so I highly doubt that.

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Nov 18, 2015

I doubt it relates to node-gyp in any way. I'm on OS X 10.11, I've been using lots of native dependencies like node-sass, even before they released binaries for new Node.js versions and they compiled correctly. So my setup is fine. And yet:

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

I did install all dependencies directly from Node.js 4.

mgol commented Nov 18, 2015

I doubt it relates to node-gyp in any way. I'm on OS X 10.11, I've been using lots of native dependencies like node-sass, even before they released binaries for new Node.js versions and they compiled correctly. So my setup is fine. And yet:

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

I did install all dependencies directly from Node.js 4.

@visionscaper

This comment has been minimized.

Show comment
Hide comment
@visionscaper

visionscaper Nov 18, 2015

@vkarpov15 you are right, my mistake. The error occurred when trying to require the module in node, after updating with npm. I tried to make it work for multiple hours but non of the advice given online seemed to help, so I downgraded again and haven't looked at it since.

@vkarpov15 you are right, my mistake. The error occurred when trying to require the module in node, after updating with npm. I tried to make it work for multiple hours but non of the advice given online seemed to help, so I downgraded again and haven't looked at it since.

@ictianspecialist

This comment has been minimized.

Show comment
Hide comment
@ictianspecialist

ictianspecialist Dec 2, 2015

I just resolved that.

When you install the mongoose module by npm, it does not have a built bson module in it's folder. In the file node_modules/mongoose/node_modules/mongodb/node_modules/bson/ext/index.js, change the line

bson = require('../build/Release/bson');
to

bson = require('bson');

I just resolved that.

When you install the mongoose module by npm, it does not have a built bson module in it's folder. In the file node_modules/mongoose/node_modules/mongodb/node_modules/bson/ext/index.js, change the line

bson = require('../build/Release/bson');
to

bson = require('bson');

@mnpenner

This comment has been minimized.

Show comment
Hide comment
@mnpenner

mnpenner Dec 21, 2015

Same problem on FreeBSD.

How do we get the C++ BSON extension to build?


Here's what npm install said:

> kerberos@0.0.11 install /usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

gmake: Entering directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/kerberos/build'
  SOLINK_MODULE(target) Release/obj.target/kerberos.node
  COPY Release/kerberos.node
gmake: Leaving directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/kerberos/build'

> bson@0.2.22 install /usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

gmake: Entering directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/bson/build'
  CXX(target) Release/obj.target/bson/ext/bson.o
bson.target.mk:88: recipe for target 'Release/obj.target/bson/ext/bson.o' failed
gmake: Leaving directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/bson/build'
crypto@0.0.3 node_modules/crypto

bson@0.4.20 node_modules/bson

Same problem on FreeBSD.

How do we get the C++ BSON extension to build?


Here's what npm install said:

> kerberos@0.0.11 install /usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

gmake: Entering directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/kerberos/build'
  SOLINK_MODULE(target) Release/obj.target/kerberos.node
  COPY Release/kerberos.node
gmake: Leaving directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/kerberos/build'

> bson@0.2.22 install /usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

gmake: Entering directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/bson/build'
  CXX(target) Release/obj.target/bson/ext/bson.o
bson.target.mk:88: recipe for target 'Release/obj.target/bson/ext/bson.o' failed
gmake: Leaving directory '/usr/local/herbert/node_modules/ac-node/node_modules/mongodb/node_modules/bson/build'
crypto@0.0.3 node_modules/crypto

bson@0.4.20 node_modules/bson
@renanborgez

This comment has been minimized.

Show comment
Hide comment
@renanborgez

renanborgez Dec 27, 2015

same problem here

same problem here

@antoinepairet

This comment has been minimized.

Show comment
Hide comment
@antoinepairet

antoinepairet Jan 12, 2016

Contributor

@vkarpov15 I confirm what @mgol is saying. There is another issue than a wrong node-gyp config. I also have lots of other native module building correctly. No error occurs when installing.

There is an issue with node v4 that prevents having the c++ bson extension, resulting in the warning js-bson: Failed to load c++ bson extension, using pure JS version.

Here is the full log when I install mongoose (mongoose@3.8.38) on node v4

apairet$ rm -rf node_modules/mongoose
apairet$ npm install
-
> bson@0.2.22 install /sources/project/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bson/ext/bson.o

> kerberos@0.0.11 install /sources/project/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o

mongoose@3.8.38 node_modules/mongoose
├── hooks@0.2.1
├── regexp-clone@0.0.1
├── muri@1.1.0
├── mpath@0.1.1
├── ms@0.1.0
├── sliced@0.0.5
├── mpromise@0.4.3
├── mquery@1.6.1 (debug@2.2.0, bluebird@2.9.26)
└── mongodb@1.4.38 (readable-stream@2.0.5, bson@0.2.22, kerberos@0.0.11)

For the sake of completeness, I installed the latest version of mongoose (mongoose@4.3.5) but the error remained the same:

apairet$ npm install mongoose@latest
npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
-
> kerberos@0.0.17 install /sources/project/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99 [-Wimplicit-function-declaration]
        maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
                   ^
1 warning generated.
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/kerberos.node
mongoose@4.3.5 node_modules/mongoose
├── ms@0.7.1
├── hooks-fixed@1.1.0
├── async@0.9.0
├── regexp-clone@0.0.1
├── mpromise@0.5.4
├── mpath@0.1.1
├── muri@1.0.0
├── sliced@0.0.5
├── kareem@1.0.1
├── bson@0.4.19
├── mquery@1.6.3 (debug@2.2.0, bluebird@2.9.26)
└── mongodb@2.1.2 (es6-promise@3.0.2, readable-stream@1.0.31, kerberos@0.0.17, mongodb-core@1.2.30)

Le me know if I can provide additional information.
rgds

Contributor

antoinepairet commented Jan 12, 2016

@vkarpov15 I confirm what @mgol is saying. There is another issue than a wrong node-gyp config. I also have lots of other native module building correctly. No error occurs when installing.

There is an issue with node v4 that prevents having the c++ bson extension, resulting in the warning js-bson: Failed to load c++ bson extension, using pure JS version.

Here is the full log when I install mongoose (mongoose@3.8.38) on node v4

apairet$ rm -rf node_modules/mongoose
apairet$ npm install
-
> bson@0.2.22 install /sources/project/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bson/ext/bson.o

> kerberos@0.0.11 install /sources/project/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o

mongoose@3.8.38 node_modules/mongoose
├── hooks@0.2.1
├── regexp-clone@0.0.1
├── muri@1.1.0
├── mpath@0.1.1
├── ms@0.1.0
├── sliced@0.0.5
├── mpromise@0.4.3
├── mquery@1.6.1 (debug@2.2.0, bluebird@2.9.26)
└── mongodb@1.4.38 (readable-stream@2.0.5, bson@0.2.22, kerberos@0.0.11)

For the sake of completeness, I installed the latest version of mongoose (mongoose@4.3.5) but the error remained the same:

apairet$ npm install mongoose@latest
npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
-
> kerberos@0.0.17 install /sources/project/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99 [-Wimplicit-function-declaration]
        maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
                   ^
1 warning generated.
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/kerberos.node
mongoose@4.3.5 node_modules/mongoose
├── ms@0.7.1
├── hooks-fixed@1.1.0
├── async@0.9.0
├── regexp-clone@0.0.1
├── mpromise@0.5.4
├── mpath@0.1.1
├── muri@1.0.0
├── sliced@0.0.5
├── kareem@1.0.1
├── bson@0.4.19
├── mquery@1.6.3 (debug@2.2.0, bluebird@2.9.26)
└── mongodb@2.1.2 (es6-promise@3.0.2, readable-stream@1.0.31, kerberos@0.0.17, mongodb-core@1.2.30)

Le me know if I can provide additional information.
rgds

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Jan 13, 2016

Collaborator

@antoinepairet which version of node exactly? There's a lot of v4 releases.

Collaborator

vkarpov15 commented Jan 13, 2016

@antoinepairet which version of node exactly? There's a lot of v4 releases.

@antoinepairet

This comment has been minimized.

Show comment
Hide comment
@antoinepairet

antoinepairet Jan 13, 2016

Contributor

Thanks for your quick answer @vkarpov15. I really appreciate that :-).
Sorry for not mentioning the node version in my previous post. I tested 3 node versions:
4.2.1, 4.1.0 and 4.0.0 with the following procedure:

  1. nvm install 4.1.0
  2. rm -rf node_modules/
  3. npm install
  4. test the app and see if the warning occurs

Each time having js-bson: Failed to load c++ bson extension, using pure JS version

I have performed the extended tests on OSX. On Linux, I only tested 4.2.1.

Let me know if I can provide more info / testing.
Thanks again

PS: @AsyaHristeva It is not a matter of C++ IDE. other native modules build just fine :-)

Contributor

antoinepairet commented Jan 13, 2016

Thanks for your quick answer @vkarpov15. I really appreciate that :-).
Sorry for not mentioning the node version in my previous post. I tested 3 node versions:
4.2.1, 4.1.0 and 4.0.0 with the following procedure:

  1. nvm install 4.1.0
  2. rm -rf node_modules/
  3. npm install
  4. test the app and see if the warning occurs

Each time having js-bson: Failed to load c++ bson extension, using pure JS version

I have performed the extended tests on OSX. On Linux, I only tested 4.2.1.

Let me know if I can provide more info / testing.
Thanks again

PS: @AsyaHristeva It is not a matter of C++ IDE. other native modules build just fine :-)

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Jan 14, 2016

Collaborator

Hmm on 4.1.1 mongoose@4.3.5 works fine on my mac, and either way that error shouldn't happen because mongoose@4.3.5 uses mongodb@2.x, which doesn't use a C++ extension for BSON. I do get this error with mongoose@3.8.38, but that's because the legacy mongodb driver releases, mongodb@1.x, don't really support node >= 4.

Collaborator

vkarpov15 commented Jan 14, 2016

Hmm on 4.1.1 mongoose@4.3.5 works fine on my mac, and either way that error shouldn't happen because mongoose@4.3.5 uses mongodb@2.x, which doesn't use a C++ extension for BSON. I do get this error with mongoose@3.8.38, but that's because the legacy mongodb driver releases, mongodb@1.x, don't really support node >= 4.

@jwerre

This comment has been minimized.

Show comment
Hide comment
@jwerre

jwerre Jan 20, 2016

I'm getting the same error with Node v4.2.4, Mongo v2.6.11, OSX 10.11.2

npm install mongoose@4.3.6
npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

> kerberos@0.0.18 install /Users/jw/Work/sp_app/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99 [-Wimplicit-function-declaration]
        maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
                   ^
1 warning generated.
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/kerberos.node
npm WARN unmet dependency /Users/jw/Work/sp_app/node_modules/latest/node_modules/npm requires request@'~2.67.0' but will load
npm WARN unmet dependency /Users/jw/Work/sp_app/node_modules/request,
npm WARN unmet dependency which is version 2.27.0
mongoose@4.3.6 node_modules/mongoose
├── ms@0.7.1
├── hooks-fixed@1.1.0
├── async@0.9.0
├── regexp-clone@0.0.1
├── mpromise@0.5.4
├── mpath@0.1.1
├── muri@1.0.0
├── sliced@0.0.5
├── kareem@1.0.1
├── bson@0.4.21
├── mquery@1.6.3 (debug@2.2.0, bluebird@2.9.26)
└── mongodb@2.1.4 (es6-promise@3.0.2, readable-stream@1.0.31, kerberos@0.0.18, mongodb-core@1.2.32)

When I run my app I get:

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

I wonder if this is an OSX issue because I don't have any problems on Linux. Could this have something to do with the gcc, the default Clang compiler installed by XCode.

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

jwerre commented Jan 20, 2016

I'm getting the same error with Node v4.2.4, Mongo v2.6.11, OSX 10.11.2

npm install mongoose@4.3.6
npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

> kerberos@0.0.18 install /Users/jw/Work/sp_app/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99 [-Wimplicit-function-declaration]
        maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
                   ^
1 warning generated.
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/kerberos.node
npm WARN unmet dependency /Users/jw/Work/sp_app/node_modules/latest/node_modules/npm requires request@'~2.67.0' but will load
npm WARN unmet dependency /Users/jw/Work/sp_app/node_modules/request,
npm WARN unmet dependency which is version 2.27.0
mongoose@4.3.6 node_modules/mongoose
├── ms@0.7.1
├── hooks-fixed@1.1.0
├── async@0.9.0
├── regexp-clone@0.0.1
├── mpromise@0.5.4
├── mpath@0.1.1
├── muri@1.0.0
├── sliced@0.0.5
├── kareem@1.0.1
├── bson@0.4.21
├── mquery@1.6.3 (debug@2.2.0, bluebird@2.9.26)
└── mongodb@2.1.4 (es6-promise@3.0.2, readable-stream@1.0.31, kerberos@0.0.18, mongodb-core@1.2.32)

When I run my app I get:

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

I wonder if this is an OSX issue because I don't have any problems on Linux. Could this have something to do with the gcc, the default Clang compiler installed by XCode.

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
@tomwang1013

This comment has been minimized.

Show comment
Hide comment
@tomwang1013

tomwang1013 Feb 25, 2016

@vkarpov15 is right, update mongoose to 4.4.5 fix this problem

@vkarpov15 is right, update mongoose to 4.4.5 fix this problem

@jwerre

This comment has been minimized.

Show comment
Hide comment
@jwerre

jwerre Feb 26, 2016

@vkarpov15, Am I correct in assuming this issue is caused by running newer version of Mongoose with older versions of MongoDB — version 2.X for instance?

jwerre commented Feb 26, 2016

@vkarpov15, Am I correct in assuming this issue is caused by running newer version of Mongoose with older versions of MongoDB — version 2.X for instance?

@vkarpov15

This comment has been minimized.

Show comment
Hide comment
@vkarpov15

vkarpov15 Mar 1, 2016

Collaborator

No, the mongodb version has nothing to do with it.

Collaborator

vkarpov15 commented Mar 1, 2016

No, the mongodb version has nothing to do with it.

@nityanarayan44

This comment has been minimized.

Show comment
Hide comment
@nityanarayan44

nityanarayan44 Mar 4, 2016

[FIXED]

I also had this problem


OS: Windows 10
node: v4.2.3
npm: 2.14.7


i just simply set the python path

npm config set python python2.7

and reinstall the mongoose

npm install mongoose


and it worked.

[FIXED]

I also had this problem


OS: Windows 10
node: v4.2.3
npm: 2.14.7


i just simply set the python path

npm config set python python2.7

and reinstall the mongoose

npm install mongoose


and it worked.

@lutaoact

This comment has been minimized.

Show comment
Hide comment

lutaoact commented Apr 7, 2016

@nityanarayan44 It worked for me

@lutaoact

This comment has been minimized.

Show comment
Hide comment
@lutaoact

lutaoact Apr 7, 2016

@mgol
I use OSX 10.10.5, node 4.4.2, npm 2.15.0, keystone 0.3.17

I went to node_modules/keystone/package.json, and remove mongoose from dependencies, then

npm config set python python2.7
npm install mongoose

this worked for me:

lutaoact commented Apr 7, 2016

@mgol
I use OSX 10.10.5, node 4.4.2, npm 2.15.0, keystone 0.3.17

I went to node_modules/keystone/package.json, and remove mongoose from dependencies, then

npm config set python python2.7
npm install mongoose

this worked for me:

@Joselarcu

This comment has been minimized.

Show comment
Hide comment
@Joselarcu

Joselarcu Apr 8, 2016

Also worked for me the @nityanarayan44 solution

Also worked for me the @nityanarayan44 solution

@DrumSergio DrumSergio referenced this issue in genieacs/genieacs Apr 25, 2016

Closed

Cannot find module '../build/Release/bson' #149

@sunfeng90

This comment has been minimized.

Show comment
Hide comment
@sunfeng90

sunfeng90 May 2, 2016

Same problem.My version is node 2.15, platform Centos

Same problem.My version is node 2.15, platform Centos

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol May 2, 2016

There's no such version of Node as 2.15 so I think you mean io.js. And
io.js has been unsupported by upstream for a long time, upgrade to Node 4
or 6 ASAP.

Michał Gołębiowski

mgol commented May 2, 2016

There's no such version of Node as 2.15 so I think you mean io.js. And
io.js has been unsupported by upstream for a long time, upgrade to Node 4
or 6 ASAP.

Michał Gołębiowski

@sunfeng90

This comment has been minimized.

Show comment
Hide comment
@sunfeng90

sunfeng90 May 2, 2016

@arefm Thx,it worked for me about updating the version 3.8.23.What's more,solveing another problem: length is undefined and so on.

sunfeng90 commented May 2, 2016

@arefm Thx,it worked for me about updating the version 3.8.23.What's more,solveing another problem: length is undefined and so on.

@mnpenner

This comment has been minimized.

Show comment
Hide comment
@mnpenner

mnpenner May 2, 2016

@mgol He was talking about npm. The latest version of npm2 is 2.15.4.

mnpenner commented May 2, 2016

@mgol He was talking about npm. The latest version of npm2 is 2.15.4.

@jwerre

This comment has been minimized.

Show comment
Hide comment
@jwerre

jwerre May 2, 2016

@mnpenner I believe its 3.8.8

jwerre commented May 2, 2016

@mnpenner I believe its 3.8.8

@mnpenner

This comment has been minimized.

Show comment
Hide comment
@mnpenner

mnpenner May 3, 2016

@jwerre I said npm2. Some of us are stuck on npm 2 because 3 has a whole host of different problems.

mnpenner commented May 3, 2016

@jwerre I said npm2. Some of us are stuck on npm 2 because 3 has a whole host of different problems.

@sunfeng90

This comment has been minimized.

Show comment
Hide comment
@sunfeng90

sunfeng90 May 3, 2016

@mgol Sorry, the npm version is 2.15, not the node.

@mgol Sorry, the npm version is 2.15, not the node.

@sunfeng90

This comment has been minimized.

Show comment
Hide comment
@sunfeng90

sunfeng90 May 3, 2016

@mnpenner Yes,you are a smart man!

@mnpenner Yes,you are a smart man!

@aventurella

This comment has been minimized.

Show comment
Hide comment
@aventurella

aventurella May 10, 2016

When using with Keystone this is what worked for me to get past that error:

add the following to my package.json deps:

"mongoose": "~4.4.16",
"mongodb": "~2.1.18",
"keystone": "^0.3.19",

then

npm install

finally

rm -rf node_modules/keystone/node_modules/mongodb
rm -rf node_modules/keystone/node_modules/mongoose

Now I don't get the error.

When using with Keystone this is what worked for me to get past that error:

add the following to my package.json deps:

"mongoose": "~4.4.16",
"mongodb": "~2.1.18",
"keystone": "^0.3.19",

then

npm install

finally

rm -rf node_modules/keystone/node_modules/mongodb
rm -rf node_modules/keystone/node_modules/mongoose

Now I don't get the error.

@HughGrant

This comment has been minimized.

Show comment
Hide comment
@HughGrant

HughGrant May 24, 2016

@aventurella I hit the same rock when I am trying keystone today, thanks for your solution.

but now we get some extraneous errors and some missing errors, is this ok?

HughGrant commented May 24, 2016

@aventurella I hit the same rock when I am trying keystone today, thanks for your solution.

but now we get some extraneous errors and some missing errors, is this ok?

@albe-rosado

This comment has been minimized.

Show comment
Hide comment
@albe-rosado

albe-rosado Jun 24, 2016

@tomwang1013 updating mongoose solved the problem, but somehow my app is not connecting to the DB.....

@tomwang1013 updating mongoose solved the problem, but somehow my app is not connecting to the DB.....

@theothermattm

This comment has been minimized.

Show comment
Hide comment
@theothermattm

theothermattm Oct 6, 2016

In our case, the reason that the c++ version bson was not found was because we were behind a corporate proxy and something in the BSON build process needs to reach out to fetch files. When we looked in node_modules/bson/builderror.log, we saw an error like this:

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: connect ECONNREFUSED
gyp ERR! stack     at errnoException (net.js:904:11)
gyp ERR! stack     at Object.afterConnect [as oncomplete] (net.js:895:19)

Which suggested that the proxy might be the issue.

Sorry for reawakening comments on this, but I wanted to post this for anyone else that hits this in the future since this thread was very helpful in solving our issue.

In our case, the reason that the c++ version bson was not found was because we were behind a corporate proxy and something in the BSON build process needs to reach out to fetch files. When we looked in node_modules/bson/builderror.log, we saw an error like this:

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: connect ECONNREFUSED
gyp ERR! stack     at errnoException (net.js:904:11)
gyp ERR! stack     at Object.afterConnect [as oncomplete] (net.js:895:19)

Which suggested that the proxy might be the issue.

Sorry for reawakening comments on this, but I wanted to post this for anyone else that hits this in the future since this thread was very helpful in solving our issue.

@Yugloocamai

This comment has been minimized.

Show comment
Hide comment
@Yugloocamai

Yugloocamai Oct 11, 2016

@aventurella thanks for your fix, it worked! Makes me feel a little funny though.

@aventurella thanks for your fix, it worked! Makes me feel a little funny though.

@GST5555

This comment has been minimized.

Show comment
Hide comment
@GST5555

GST5555 Jul 6, 2018

I have this issue on Windows 10, can't run a "basic" example either... is supposed that the installation files should provide all the stuff to run something, or at least have the instructions to do so...
This is fucking annoying!!!!! :@

GST5555 commented Jul 6, 2018

I have this issue on Windows 10, can't run a "basic" example either... is supposed that the installation files should provide all the stuff to run something, or at least have the instructions to do so...
This is fucking annoying!!!!! :@

@lineus

This comment has been minimized.

Show comment
Hide comment
@lineus

lineus Jul 6, 2018

Collaborator

@GST5555 if you would like to get some help in real time, please feel free to join us in either of these communities:
Gitter.im
Slack

Collaborator

lineus commented Jul 6, 2018

@GST5555 if you would like to get some help in real time, please feel free to join us in either of these communities:
Gitter.im
Slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment