Nodejs - 如何编译 bson 解析器?
每次我尝试在 Nodejs 中执行任何操作,与 mangodb 或套接字连接的内容时,我都会收到错误:
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
我应该编译、使用、安装什么来避免它? 我正在尝试安装 mangodb,node-mongodb-native 在 node-mongodb-native 安装期间我收到消息:
cxx: bson.cc -> build/default/bson_1.o
所以可能我在某处有 bson...
我正在使用: 节点0.4.7 Ubuntu 10.10
编辑。 我正在尝试运行的内容:
我下载了 github.com/pubsubio/chat
为此项目安装的打包是:
/home/mrok/nodejs/pubsub/pubsubio-chat ├── [电子邮件受保护] ├── [电子邮件受保护] ├── [电子邮件受保护] ├── [电子邮件受保护] ├─┬ [电子邮件受保护] │ ├── [电子邮件受保护] │ └── [电子邮件受保护] ├─┬ [电子邮件受保护] │ ├── [电子邮件受保护] │ └── [电子邮件受保护] ├─┬ [电子邮件受保护] │ └── [电子邮件受保护] └── [电子邮件受保护]
我仍然收到:
原生bson解析器未编译,请编译或避免使用 native_parser=true
欢迎任何提示。
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:
I downloaded github.com/pubsubio/chat
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过将 node-mongodb-native/lib/mongodb/db.js 文件的第 28 行更改为
this.native_parser = this.options.native_parser = false;
您还可以使用 npm install mongodb --mongodb:native
但是,不建议这样做,因为本机驱动程序比 JavaScript 驱动程序运行得慢。
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.
开始更新
安装 mongodb-native
安装 mongojs
结束更新
首先安装 npm.next 我建议你安装 mongoose 代替。它是非常流行的 mongodb 实用程序库。当您使用像 npm 这样的包管理器时,您的依赖项将自动安装。
BEGIN UPDATE
Install mongodb-native
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.