5

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
├── bson@0.0.3 
├── common@0.1.1 
├── galletita@0.1.1 
├── mongodb@0.9.6-7 
├─┬ mongojs@0.1.6 
│ ├── common@0.1.1 
│ └── mongodb@0.9.6-7 
├─┬ mongoose@1.7.3 
│ ├── colors@0.5.0 
│ └── hooks@0.1.9 
├─┬ pubsub.io@0.1.7 
│ └── json-sockets@0.2.0 
└── router@0.3.1

and I still receive:

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

Any tips are welcome.

mrok
  • 2,680
  • 3
  • 27
  • 46

2 Answers2

2

I fixed the problem by changing the line 28 of node-mongodb-native/lib/mongodb/db.js file to this.native_parser = this.options.native_parser = false;

You can also use npm install mongodb --mongodb:native

However, it is not recommended since the native driver works slower than the JavaScript one.

  • this worked form me, although it wasnt on line 28, a search for 'this.native_parser' revealed the necessary edit, this will do as a temporary fix so that i can at least play with node and mongo, cheers all – Opentuned Dec 31 '12 at 10:56
1

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.

Alfred
  • 60,935
  • 33
  • 147
  • 186
  • Thanks for help, unfortunately problem still occurs. – mrok Jul 20 '11 at 20:45
  • wow - I did not expect that installing bson can be so easy. Thanks for this. You helped me a lot, but I still have the same case. I will describe more what I am going to achieve. 1. I downloaded https://github.com/pubsubio/chat 2. Installed packaged for this project are: /home/mrok/nodejs/pubsub/pubsubio-chat ├── bson@0.0.3 ├── common@0.1.1 ├── galletita@0.1.1 ├── mongodb@0.9.6-7 ├─┬ mongojs@0.1.6 │ ├── common@0.1.1 │ └── mongodb@0.9.6-7 ├─┬ mongoose@1.7.3 │ ├── colors@0.5.0 │ └── hooks@0.1.9 ├─┬ pubsub.io@0.1.7 │ └── json-sockets@0.2.0 └── router@0.3.1 – mrok Jul 21 '11 at 21:54
  • @mrok the more information you provide the better stackoverflow users can help you. – Alfred Jul 21 '11 at 21:57
  • Formatting in comment looks bad also comments has length limit. I will update main question. PS. bison that sounds heavy ;) – mrok Jul 21 '11 at 22:04
  • lol you need to install mongojs => `npm install mongojs`. That's all :P – Alfred Jul 22 '11 at 11:31
  • 2
    ok I have solution. I needed to find every node_modules directory which contained mongodb package, removed it and install again by npm install mongodb --mongodb:native Alfred thanks for your tips and advices – mrok Jul 23 '11 at 15:04