2011-07-28 27 views
1

我用npm install mongojs得到的包裝,但是當試圖運行 我的應用程序,我得到以下錯誤:無法獲得mongojs(節點MongoDB的原生包裝)在Ubuntu 10.10的工作

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獲取源代碼並編譯自己的native-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 

任何想法爲什麼這是失敗的,我如何使它工作?

回答

0

的沒有這樣的文件或目錄編譯終止錯誤可能意味着你沒有創建一個數據/ db目錄MongoDB的使用。

$ sudo mkdir -p /data/db/ 
$ sudo chown `id -u` /data/db 

我似乎記得當我嘗試使用shell連接到MongoDB時看到類似這樣的事情。你可以用shell連接嗎?

1

之前的事情是固定的,你必須使用節點0.5.1(可以使用gitk樹恢復到這個版本)

Auteur: Ryan Dahl <[email protected]> 2011-07-19 10:46:38 
Auteur du commit: Ryan Dahl <[email protected]> 2011-07-19 10:46:38 
Parent: 0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b (Remove StatWatcher's dep on C++ EventEmitter) 
Enfant: 061ce7b0ac370c8a5ae93d95ab7da171cbd488f0 (net_uv: Fix simple/test-http-expect-continue.js) 
Branche: master, remotes/origin/master 
Suit: v0.5.1 
Précède: v0.5.2 
Finally remove node::EventEmitter 
0

Softwarepadawan,請升級到Mongjs的最新版本。今天下午,我推出了一個解決此問題的提交,並使用JS解析器而不是本地解析器。

+0

差異 - https://github.com/gett/mongojs/commit/3c052020c9aff66d03d7c82a8decb7a0299b1385 – Sri