Can't get mongojs (node-mongodb-native wrapper) to work Ubuntu 10.10

309 views
Skip to first unread message

Tim Skauge

unread,
Jul 28, 2011, 1:28:41 PM7/28/11
to node-mongodb-native
I used npm install mongojs to get the wrapper, but when trying to run
my app I get the following error:
node.js:195
throw e; // process.nextTick error, or 'error' event on first
tick
^
Native bson parser not compiled, please compile or avoid using
native_parser=true

I then tried to get the source from github and compile node-mongodb-
native myself. Then I get the following error when running make:

make -C ./external-libs/bson
make[1]: Entering directory `/tmp/node-mongodb-native/external-libs/
bson'
rm -rf build .lock-wscript bson.node
node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.069s)
Waf: Entering directory `/tmp/node-mongodb-native/external-libs/bson/
build'
[1/9] cxx: bson.cc -> build/default/bson_1.o
[2/9] cxx: long.cc -> build/default/long_1.o
[3/9] cxx: objectid.cc -> build/default/objectid_1.o
[5/9] cxx: code.cc -> build/default/code_1.o
[4/9] cxx: binary.cc -> build/default/binary_1.o
[6/9] cxx: dbref.cc -> build/default/dbref_1.o
../bson.cc:7:25: fatal error: node_events.h: No such file or directory
compilation terminated.
../objectid.cc:6:25: fatal error: node_events.h: No such file or
directory
compilation terminated.
../code.cc:6:25: fatal error: node_events.h: No such file or directory
compilation terminated.
../dbref.cc:6:25: fatal error: node_events.h: No such file or
directory
compilation terminated.
../long.cc:6:25: fatal error: node_events.h: No such file or directory
compilation terminated.
../binary.cc:7:25: fatal error: node_events.h: No such file or
directory
compilation terminated.
Waf: Leaving directory `/tmp/node-mongodb-native/external-libs/bson/
build'
Build failed:
-> task failed (err #1):
{task: cxx objectid.cc -> objectid_1.o}
-> task failed (err #1):
{task: cxx bson.cc -> bson_1.o}
-> task failed (err #1):
{task: cxx code.cc -> code_1.o}
-> task failed (err #1):
{task: cxx dbref.cc -> dbref_1.o}
-> task failed (err #1):
{task: cxx long.cc -> long_1.o}
-> task failed (err #1):
{task: cxx binary.cc -> binary_1.o}
make[1]: *** [all] Error 1
make[1]: Leaving directory `/tmp/node-mongodb-native/external-libs/
bson'
make: *** [build_native] Error 2

Any ideas to why this is failing and how I can make it work?

Laurie Harper

unread,
Jul 28, 2011, 4:34:47 PM7/28/11
to node-mong...@googlegroups.com
One option would be to bug the maintainer of mongojs and have them stop using native_parser=true ;-)

I don't know why the native BSON parser is failing to compile; it looks like you're missing the Node headers on your system; how did you install Node?

L.

--
Laurie Harper
http://laurie.holoweb.net/

Tim Skauge

unread,
Jul 29, 2011, 2:49:53 AM7/29/11
to node-mong...@googlegroups.com
Installed node by getting source from github and compiled on my machine (./configure make make install).
How do I add the node headers to my system?

Tim Skauge

Laurie Harper

unread,
Jul 29, 2011, 3:33:10 AM7/29/11
to node-mong...@googlegroups.com
'make install' does it, but if you compiled from the master branch you're using 0.5.x-pre, which probably isn't supported. Unless you need to work against the bleeding edge for some reason, you should install the latest 0.4.x version instead.

If you *do* need to work against 0.5, you should try with 0.4 and see if it compiles cleanly; if so, you'll need to either wait for 0.5 support, or patch it in and send a pull request.

L.

Tim Skauge

unread,
Jul 29, 2011, 4:15:03 AM7/29/11
to node-mong...@googlegroups.com
Installed the stable version of node and all my problems went away.
I didn't know there were stable and unstable versions of node. Just followed the guides that I found on how to install node.

Thanks for you help.

Tim Skauge

Tim Skauge

unread,
Jul 29, 2011, 4:15:07 AM7/29/11
to node-mong...@googlegroups.com
Installed the stable version of node and all my problems went away.
I didn't know there were stable and unstable versions of node. Just followed the guides that I found on how to install node.

Thanks for you help.

Tim Skauge



On Fri, Jul 29, 2011 at 9:33 AM, Laurie Harper <lau...@holoweb.net> wrote:

shinout

unread,
Aug 10, 2011, 11:24:15 PM8/10/11
to node-mongodb-native
Hi, I encountered the same problem in installation using node v0.5.2.
It said that "node_events.h" was missing in bson.cc.
This is because in current Node.js ( v0.5.x) doesn't have
node_events.h .
I tried to modify bson.cc, but BSON extends EventEmitter,
which doesn't seem to be defined in any c++ sources, (instead, it is
defined in a file "node.js")
so I couldn't fix it.

Does anyone know the solution?

christkv

unread,
Aug 11, 2011, 5:27:22 AM8/11/11
to node-mongodb-native
Please stop using the native parser. The js parser is better and
faster. I'm going to make a simple test at some point going forward
just to see if there is any point at all with a c++ parser but right
now it's slower than the js one.

Use the js == no problems with either the 0.4 or 0.5 branch.

Navaru

unread,
Aug 19, 2011, 7:55:03 PM8/19/11
to node-mongodb-native
How to install it without the native parser or how to use it with 0.5
branch?

A few pointers please :)

christkv

unread,
Aug 20, 2011, 8:50:57 AM8/20/11
to node-mongodb-native
npm install mongodb

Default install is without the native bson parser

Laurie Harper

unread,
Aug 20, 2011, 1:50:48 PM8/20/11
to node-mong...@googlegroups.com
I was gong to post the same reply until I realized the subject was mongojs, not just mongodb. I'm assuming that is the part that's enabling the native bson parser...

--
Laurie Harper
http://laurie.holoweb.net/

Reply all
Reply to author
Forward
0 new messages