gpt4 book ai didi

node.js - npm install --save loopback-connector-mongodb 失败

转载 作者:可可西里 更新时间:2023-11-01 10:03:27 25 4
gpt4 key购买 nike

我是 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)

我有 node 版本 4.0.0,ubuntu mate 15.04 和 mongo 3.0.6

最佳答案

错误消息 /usr/bin/ld: cannot find -lkrb5 表示找不到构建 kerberos 模块所需的库 libkrb5。只需安装该库:apt-get install libkrb5-dev 即可消除该错误消息。参见 installation guide .

但是 mongodb 驱动程序没有它也能正常运行,只是不支持 kerberos 身份验证。

关于node.js - npm install --save loopback-connector-mongodb 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32661980/

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