我是node.js的新手,我想学习环回。我尝试按照本教程进行操作,第一部分进展顺利,直到我将环回连接器安装到mongodb。
npm install --save loopback-connector-mongodb
我得到的错误似乎很难在网上找到,我对npm和node-gyp和mongodb的知识非常缺乏所以我甚至不知道什么是错的。有谁能建议如何解决它?
这是终端日志:
npm WARN package.json loopback-getting-started@1.0.0 No license field.
-
> kerberos@0.0.14 install /home/qw/Work/Nodejs-Apps/loopback-getting-started/node_modules/loopback-connector-mongodb/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)
make: Entering directory '/home/qw/Work/Nodejs-Apps/loopback-getting-started/node_modules/loopback-connector-mongodb/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build'
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:27:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
#pragma clang diagnostic push
^
../lib/kerberosgss.c:28:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
^
../lib/kerberosgss.c: In function ‘authenticate_gss_client_wrap’:
../lib/kerberosgss.c:348:19: warning: variable ‘server_conf_flags’ set but not used [-Wunused-but-set-variable]
char buf[4096], server_conf_flags;
^
../lib/kerberosgss.c: At top level:
../lib/kerberosgss.c:687:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
#pragma clang diagnostic pop
^
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/obj.target/kerberos.node
/usr/bin/ld: cannot find -lkrb5
/usr/bin/ld: cannot find -lgssapi_krb5
collect2: error: ld returned 1 exit status
kerberos.target.mk:133: recipe for target 'Release/obj.target/kerberos.node' failed
make: *** [Release/obj.target/kerberos.node] Error 1
make: Leaving directory '/home/qw/Work/Nodejs-Apps/loopback-getting-started/node_modules/loopback-connector-mongodb/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-26-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/qw/Work/Nodejs-Apps/loopback-getting-started/node_modules/loopback-connector-mongodb/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok
loopback-connector-mongodb@1.13.0 node_modules/loopback-connector-mongodb
├── async@1.4.2
├── loopback-connector@2.3.0
├── debug@2.2.0 (ms@0.7.1)
└── mongodb@2.0.43 (es6-promise@2.1.1, readable-stream@1.0.31, mongodb-core@1.2.12)
我有节点版本4.0.0,ubuntu配对15.04和mongo 3.0.6
答案 0 :(得分:3)
错误消息/usr/bin/ld: cannot find -lkrb5
表示无法找到构建kerberos模块所需的库libkrb5
。只需安装该库:apt-get install libkrb5-dev
即可清除该错误消息。请参阅installation guide。
但没有它,mongodb驱动程序会正常运行,只有kerberos身份验证才能得到支持。