无法让 mongojs(node-mongodb-native 包装器)在 Ubuntu 10.10 上工作
我使用 npm install mongojs
来获取包装器,但是在尝试运行时 我的应用程序出现以下错误:
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
然后我尝试从 github 获取源代码并编译 node-mongodb- 我自己是本地人。然后,在运行 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
[4/9] cxx: binary.cc -> build/default/binary_1.o
[5/9] cxx: code.cc -> build/default/code_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
对于为什么失败以及如何使其工作有什么想法吗?
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
[4/9] cxx: binary.cc -> build/default/binary_1.o
[5/9] cxx: code.cc -> build/default/code_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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在问题修复之前,您必须使用节点 0.5.1(您可以使用 gitk 将树恢复到此版本)
before things are fixed you must use node 0.5.1 (you can use gitk to revert the tree to this version)
我认为您需要将 Node 添加到 .bashrc 或任何文件中的 PATH,具体取决于您的发行版。
请参阅此链接:http://shapeshed.com/日志/setting-up-nodejs-and-npm-on-mac-osx/
I think you need to add Node to your PATH in .bashrc or whatever the file is, depending on your distro.
See this link: http://shapeshed.com/journal/setting-up-nodejs-and-npm-on-mac-osx/
没有这样的文件或目录编译终止错误可能意味着您尚未创建可供 MongoDB 使用的 data/db 目录。
我似乎记得当我尝试使用 shell 连接到 MongoDB 时看到类似的东西。可以用shell连接吗???
The No such file or directory compilation terminated error could mean that you have not created a data/db directory for MongoDB to use.
I seem to remember seeing something like this when I tried connecting to the MongoDB using the shell. Can you connect using the shell???
Softwarepadawan,请升级到最新版本的Mongjs。今天下午,我推送了一个修复此问题的提交,并使用 JS 解析器而不是本机解析器。
Softwarepadawan, Please upgrade to the latest version of Mongjs. This afternoon I pushed a commit that fixes this and uses the JS parser instead of native parser.