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

Created on 7 Sep 2014  Β·  115Comments  Β·  Source: Automattic/mongoose

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).

Most helpful comment

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.

All 115 comments

Same problem

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

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

ok

Same problem

Same here. Will stay 3.8.15 till changes.

Ok.... Same problem!

Any update on this?

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 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?

npm 2.1.7 on Os X 10.9.5

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.

+1

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

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

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.

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

Plans to fix this?

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

+1

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

Any workaround or plans to fix it?

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

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.
#
##############################################################

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

"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.

You win!

Please excuse me, it was my fault.

builderror.log:
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.4.2, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack at failPythonVersion (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:108:14)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:97:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:735:7)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at maybeClose (child_process.js:1008:16)
gyp ERR! stack at Socket. (child_process.js:1176:11)
gyp ERR! stack at Socket.emit (events.js:107:17)
gyp ERR! stack at Pipe.close (net.js:476:12)
gyp ERR! System Linux 3.14.27-1-lts
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/node/sites/hellooo/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok

In my case the solution was:

npm config set python python2.7

Reinstall mongoose and working.

I did not pay attention to this lines from the output of 'npm install':

[email protected] install /home/node/sites/hellooo/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson
(node-gyp rebuild 2> builderror.log) || (exit 0)

This means there was an error when building bson I had not noticed.

Thank you very much @vkarpov15.

Yes, I forget to say I updated my npm python config.

tnx @vkarpov15

hi,
I have executed "rm -rf node_modules && npm install" and I see below.

/

[email protected] install c:\Raj\project\meandemo\node_modules\mongoose\node_modu
lesmongodb\node_modules\kerberos
(node-gyp rebuild 2> builderror.log) || (exit 0)

c:\Raj\project\meandemo\node_modules\mongoose\node_modulesmongodb\node_modules\
kerberos>node "c:\Program Files\nodejs\node_modulesnpmbin\node-gyp-bin....\
node_modules\node-gypbin\node-gyp.js" rebuild

[email protected] install c:\Raj\project\meandemo\node_modules\mongoose\node_modules
mongodb\node_modulesbson
(node-gyp rebuild 2> builderror.log) || (exit 0)

When I run my server I get below error..

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }

js-bson: Failed to load c++ bson extension, using pure JS version
c:\Raj\project\meandemo\node_modules\express\lib\router\route.js:170
throw new Error(msg);
^
Error: Route.get() requires callback functions but got a [object Undefined]
at Route. (c:\Raj\project\meandemo\node_modules\express\lib\route
r\route.js:170:15)
at Array.forEach (native)
at Route.(anonymous function) as get
at EventEmitter.app.(anonymous function) (c:\Raj\project\meandemo\node_modul
es\express\lib\application.js:429:19)
at Object. (c:\Raj\project\meandemo\server.js:23:5)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)

Here are my version details:
OS: Windows 7
node: 0.12.0
mongoose: 3.8.23
npm: 2.5.1

Please suggest

Hi @rajnav, Take a look to builderror.log, it can show you the origin of the problem.

Same problem but builerror.log contains only one line :

child_process: customFds option is deprecated, use stdio instead.

in project/node_modules/mongoose/node_modules/mongodb/node_modules/bson

I'm using osx yosemite and node 0.12.x

I got this warning too, but it worked for me.

I'm using fedora 20 with node 0.12.x and got this warning. Is it safe to keep working with it?
I had no problems with node 0.10.x

It seems a deprecation warning, but unsure about aftereffects. As I said previously, it is working fine for me.

@rajnav the error looks like its in Express. The bson not found error is a warning that it couldn't find the native compiled bson binary, shouldn't be causing a crash.

Also, I have seen the customFds option deprecation warning. Should still work. I'll investigate more as to where that's coming from.

builderror.log files provides an answer.
I have passed a --python=python2.7 flag with npm install, just like it asked, and no more errors. It has worked on both, windows 64bit and ubuntu installations.

npm install --python=[path to python] mongoose

P.S.
On windows machine, I still have
child_process: customFds option is deprecated, use stdio instead.
in builderror.log file, but this doesn't cause any errors to show up in node console when running application.

mongoose: 3.8.24
npm: 2.7.9
os: Arch Linux

doing
rm -rm node_modules/
npm cache clean
npm config set python python2.7
npm install
worked for me.

do a clean npm install
happened to me after updating node.

Mongoose 3.8.21
Ubuntu 14.04.2

Using

npm config set python python2.7
cd node_modules/mongoose/node_modules/mongodb/node_modules/bson
npm install

worked for me!

So python is a requirement to use mongoose??? It's not clear on the docs, so I'm not allowed to install it on production environment. (Unless documented...) :(

Mongoose only requires Python inasmuch as node-gyp (node wrapper around v8 build system) requires python. Python is not a runtime dependency for mongoose. If you need documentation that mongoose needs python in order to build the C++ bson parser, click here.

However, once again, mongoose will work as expected even if it can't build the bson parser. The only feature that requires node-gyp to succeed is the kerberos authentication mechanism.

Thank you very much,

@jayflo that's worf for me too, now i want no more problems cause that!!

+1 Here mongodb/js-bson/issues/118

This will solve your problems:

$ cd node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/
$ npm install

So it was pretty obvious to me that whoever integrated mongodb-core into mongodb into mongoose is the one to blame. Someone missed a npm install there. Is there a way to escalate this, since clearly thousands of users are affected and (business) impact can be safely considered as very high, at least in my opinion, but I have been wrong before.

Nobody missed an npm install, it works fine if your system is configured to run node-gyp properly. That being said, configuring your system to run node-gyp properly is a major pain in the hindquarters, so we're considering pre-building binaries and having npm install try to download a pre-built binary first unless you opt out.

As for business impact, once again, this is a _warning_, not an _error_.

Thanks for your clarifying answer. grunt and node won't start if I dont npm install in the mongo-core directory, thus this warning is a show-stopper at least in my scenario and obviously (scroll up) in many others. I can see that from your perspective this is none of your projects concern, yet it fails to run fresh-out-the-box on Linux, Mac and Windows alike.

Am 17.04.2015 um 15:33 schrieb Valeri Karpov [email protected]:

rning, not an error.

if they don't start, then something else is wrong. This message is a warning and will not prevent you from starting grunt or node. Can you show me the rest of the output from your original npm install command (before you ran npm install in mongodb-core)?

Once again, if you want to get rid of this warning now, the only way right now is to set up node-gyp's dependencies.

thanks vkarpov15 for sticking it out in this thread. i just want throw up a +1 of my own so you know there's another with the same issue. that being said, i am still able to run my application, so i am going to take your advise that this is not an error, but a warning. so, here's hoping that the warning gets resolved in a future update for that extra peace of mind. thanks again.

fyi ~ this warning came up after i updated node from 10 to 12...

@camachowebworld try clearing out your node_modules and reinstalling rm -rf node_modules && npm install. Typically when you do a major node version upgrade you need to re-build any native extensions, including bson. Reinstalling should do the trick.

Ubuntu 14.04.1 LTS (AWS EC2)
Had to run "sudo apt-get install build-essential"

Can maybe help someone.

vkarpov15 thanks for replying to msg. sry about the lack of experience. you're saying to, "try clearing out your node_modules and reinstalling rm -rf node_modules && npm install". i'm on windows. where do i run these commands? i try running "rm -rf node_modules" in my project folder it tells me "rm is not.... command".

Just delete node_modules in Windows explorer, same thing. Then run npm install wherever you ran it originally.

General suggestion, use git bash + mingw if you're doing node dev on Windows

Got the same error right after update node to 0.12.3 version on Windows 7 (x64).
I already install: node-gyp, node-pre-gyp, python, .NET SDK -> after that, I no longer receives error messages about assembly. And for mongoose 3.8.28 folder mongoose\node_modules\mongodb\node_modules\bson\build\Release
contains these files:

/obj
/bson.exp
/bson.lib
/bson.node
/bson.pdb

But message

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

still appears

UPD: I found solution for me. Win7 and nodejs 0.12.3

For iojs users:

Latest versions don't support well mongoose. Downgrade to last stable release v2.0.0 (use nvm for the god sake). And it'll work like a charm!

Adding this info just in case, here in our company we had this trouble recently.

In windows I resolved this issue by changing one line in:

node_modulesmongodb\node_modulesmongodb-core\node_modulesbson\node_modulesbons-ext\ext\index.js

the line after:

// Attempt to load the release bson version
try {

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

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

is now gone and mongo seems to work fine. Using mongodb driver ver. 2.0.33

Hope it helps.

Can somebody confirm that ChrisGciso's solution is a viable one? We are now facing this same year-old issue with Atlassian Bamboo. Any ideas how to fix with Bamboo?

It is not a solution, just a hack. The same way, you can just remove console outputs in that file.

I am struggling to understand that how the fallback to JS Bson and the warning that its not as performant as C++ implementation, is just a cosmetic issue.

Stephan Kristyn
Edelweißstr. 4
81541 MΓΌnchen

+49 151 5461 8086
s.[email protected]
http://meshfields.de

On 9. Juni 2015 17:38 +0200, [email protected], wrote:

It is not a solution, just a hack. The same way, you can just remove console outputs in that file.

β€”
Reply to this email directly orview it on GitHub(https://github.com/Automattic/mongoose/issues/2285#issuecomment-110406406).

@ChrisGciso that's just sweeping the warning under the rug. That means it will use the JavaScript bson parser without checking for the compiled one.

@nottinhill I unfortunately have no experience with bamboo, so I can't help. Whether it's a 'cosmetic issue' depends on your use case - for instance, in a CI environment like bamboo, you generally worry too much about shaving off a microsecond here and saving a couple bytes of memory there. In your prod environment is where it potentially matters, and if you really need the extra bit of performance, then setting up node-gyp dependencies and reinstalling is what you need to do.

As is, one of the things we're hoping to do in the future is close the gap between the compiled bson parser and the JavaScript bson parser. If you want to contribute, you're more than welcome to at http://github.com/mongodb/js-bson :)

@vkarpov15 Sweeping "Error" messages under the rug if they don't have a simple resolution and don't cause any material impact on performance may be better than mixing them in with real errors that reflect real problems. Seeing this error over and over for months is not good unless it can be handled, especially for new people that want to use the driver. Is there a better solution that doesn't involve a complex series of steps to just get rid of the error message?

Maybe it should be labeled "Info" instead of "Error"?

A fair point. There's the native_parser flag that should prevent mongodb from looking for the compiled version of js-bson.

I'm on Fedora 22, node v0.12.4, installed tonight

npm config set python python2.7
=> solved my problems, thx

I was having this issue here in a Docker archlinux container, and my solution was:

$ pacman -S gcc make nodejs npm python2
$ npm config set python python2.7
$ npm install -g node-gyp

Mongoose version 4.0.5

Regarding the Bamboo Error - I _solved_ the issue by creating a npm task and setting your environment variable as usual, then the following parameters:

install node-gyp

You will see complaints about the missing global flag, but in Bamboo we at least don't prefer global installs due to migration flexibility.

Edit Error is back:

build   17-Jun-2015 10:30:53    Running "mochaTest:src" (mochaTest) task
build   17-Jun-2015 10:30:53    { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
error   17-Jun-2015 10:30:53    js-bson: Failed to load c++ bson extension, using pure JS version

Yes, it worked for me, thank you.

Actually, I had to install too gcc and make also, so it could compile the cpp into a binary.

β€”
Frederico Souza
RioBus co-Founder - http://riob.us/ http://riob.us/
Phone: (+55 21) 97285-8787
Rio de Janeiro, Brazil

Em 17/06/2015, Γ (s) 05:22, Stephan Kristyn [email protected] escreveu:

Regarding the Bamboo Error - I solved the issue by creating a npm task and setting your environment variable as usual, then the following parameters:

install node-gyp
You will see complaints about the missing global flag, but in Bamboo we at least don't prefer global installs due to migration flexibility.

β€”
Reply to this email directly or view it on GitHub https://github.com/Automattic/mongoose/issues/2285#issuecomment-112714644.

I had this problem. Updated connect-mongo to 0.8.2 and mongoose to version 4.0.7, and it worked fine.

Node v0.12.2, NPM 2.13.0, OSX 10.10.4

Same issue using sailsjs

Upgrade to mongoose >= 4.0.6 so bson doesn't use C++ extensions anymore. Either way, this message is just a warning.

Upgrading to 4.0.6 worked for me, thanks vkarpov15.

Same problem. use xUbuntu 15.04.
I tried install package of libkrb5-dev, nodejs-legacy. and upgrade Node.js v4.1.0, npm 2.14.3, mongoose 4.1.7. but not work :-(

Have you tried clean re-install? Also, don't worry about libkrb unless you care about kerberos auth, mongoose will work fine without it.

@TimePower Did you try global node-gyp install?

I'm getting the following error when trying to use anything Mongoose related:

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

Node 4.1.0 and Mongoose 4.1.10.

rm -rf node_modules && npm cache clean && npm install @jackdbernier

Also it's a warning, not an error.

Upgrade to mongoose >= 4.0.6 so bson doesn't use C++ extensions anymore.

I'm using Mongoose 4.1.10 and still getting the error.

i solved downgrading mongodb to 2.6

rm -rf node_modules && npm cache clean && npm install
doesn't works for me, after same error

Same issue here :

rm -rf node_modules && npm cache clean && npm install
doesn't works for me, after same error

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

My setup:

  • AWS Ubuntu machine : Ubuntu 14.04.1 LTS
  • node.js v0.12.7
  • Mongoose 4.1.12
  • MongoDB 2.6.5

This all started when I upgraded nodejs, upgrading to Mongoose 4.1.12 didn't help either.

How is this still an issue??? Should I even bother leaving any further information here... everyone else has done that for me.... Is anyone going tostabilize this or what???

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

@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.

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

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.

@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.

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');

Same problem on FreeBSD.

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


Here's what npm install said:

> [email protected] 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'

> [email protected] 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'
[email protected] node_modules/crypto

[email protected] node_modules/bson

same problem here

@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 ([email protected]) on node v4

apairet$ rm -rf node_modules/mongoose
apairet$ npm install
-
> [email protected] 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

> [email protected] 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

[email protected] node_modules/mongoose
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected])

For the sake of completeness, I installed the latest version of mongoose ([email protected]) 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.
-
> [email protected] 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
[email protected] node_modules/mongoose
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

Le me know if I can provide additional information.
rgds

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

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 :-)

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

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

npm install [email protected]
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.

> [email protected] 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
[email protected] node_modules/mongoose
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

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

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

@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?

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

[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.

@nityanarayan44 It worked for me

@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:

Also worked for me the @nityanarayan44 solution

Same problem.My version is node 2.15, platform Centos

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

@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.

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

@mnpenner I believe its 3.8.8

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

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

@mnpenner Yes,you are a smart man!

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.

@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?

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

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.

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

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 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

Was this page helpful?
0 / 5 - 0 ratings