Search code examples
node.jsbson

Nodejs - how compile bson parser?


Every time I try to do anything in Nodejs, what is connected with mangodb or sockets, then I receive error:

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Native bson parser not compiled, please compile or avoid using native_parser=true

what should I compile, use, install, etc to avoid it? I was trying install mangodb, node-mongodb-native also during node-mongodb-native installation I get message:

 cxx: bson.cc -> build/default/bson_1.o

so probably I have bson somewhere...

I am using: node 0.4.7 Ubuntu 10.10

EDIT. What I am trying to run:

  1. I downloaded github.com/pubsubio/chat

  2. Installed packaged for this project are:

/home/mrok/nodejs/pubsub/pubsubio-chat
├── [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]

and I still receive:

Native bson parser not compiled, please compile or avoid using native_parser=true

Any tips are welcome.


Solution

  • BEGIN UPDATE

    Install mongodb-native

    mkdir /tmp/mongodb-native
    cd /tmp/mongodb-native
    git clone https://github.com/christkv/node-mongodb-native
    make
    

    Install mongojs

    npm install mongojs
    

    END UPDATE

    First install npm.next I would advice you to install mongoose instead. It is very popular mongodb utility library. When you use package manager like npm your dependencies will get installed automatically.