请教Ubuntu14.04 下npm install mongodb 报错怎么处理
发布于 9 年前 作者 twang281314 6560 次浏览 最后一次编辑是 8 年前 来自 问答

下面是错误信息 root@iZ94ibykvawZ:~# npm install mongodb /

kerberos@0.0.14 install /root/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos (node-gyp rebuild) || (exit 0)

make: Entering directory /root/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build' CXX(target) Release/obj.target/kerberos/lib/kerberos.o In file included from ../lib/kerberos.cc:1:0: ../lib/kerberos.h:5:27: fatal error: gssapi/gssapi.h: No such file or directory #include <gssapi/gssapi.h> ^ compilation terminated. make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1 make: Leaving directory/root/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/src/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12) gyp ERR! System Linux 3.13.0-32-generic gyp ERR! command “node” “/usr/src/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” "rebuild" gyp ERR! cwd /root/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos gyp ERR! node -v v0.12.6 gyp ERR! node-gyp -v v2.0.1 gyp ERR! not ok mongodb@2.0.43 node_modules/mongodb ├── es6-promise@2.1.1 ├── readable-stream@1.0.31 (isarray@0.0.1, inherits@2.0.1, string_decoder@0.10.31, core-util-is@1.0.1) └── mongodb-core@1.2.12 (bson@0.4.11, kerberos@0.0.14) 麻烦知道的大神指点一下

4 回复

去查一下文档,应该是c库少头文件

安装 kerberos 依赖

sudo apt-get install libkrb5-dev

可以去mongodb官网下载tgz包,解压后配下环境变量即可。据说通过apt安装的mongodb版本比较低。

来自炫酷的 CNodeMD

@wyvernnot 嗯,的确是少了这个, 谢了 哈

回到顶部