gpt4 book ai didi

node.js - Nodejs - 如何编译 bson 解析器?

转载 作者:搜寻专家 更新时间:2023-10-31 22:48:53 24 4
gpt4 key购买 nike

每次我尝试在 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

我应该编译、使用、安装什么来避免它?我也在安装 node-mongodb-native 期间尝试安装 mangodb,node-mongodb-native 我收到消息:

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

所以我可能在某个地方有 bson...

我正在使用: Node 0.4.7Ubuntu 10.10

编辑。我要运行的是:

  1. 我下载了 github.com/pubsubio/chat

  2. 此项目的安装包是:

/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

我仍然收到:

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

欢迎任何提示。

最佳答案

我通过将 node-mongodb-native/lib/mongodb/db.js 文件的第 28 行更改为this.native_parser = this.options.native_parser = false;

你也可以使用 npm install mongodb --mongodb:native

但是,不建议这样做,因为 native 驱动程序的运行速度比 JavaScript 驱动程序慢。

关于node.js - Nodejs - 如何编译 bson 解析器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6740712/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com