我无法在我的EC2实例上安装connect-mongo。与node-gyp无法访问" /root/.node-gyp/0.10.40" - 这是stange,因为安装的Node版本是4.2.1。
文件夹" /root/.node-gyp /"甚至不退出系统。那么为什么node-gyp看起来呢?
配置服务器时,我首先安装了Node 0.10.40,然后升级到4.2.1。
我们如何将node-gyp指向正确的目录?或者其他地方的问题是什么?
在本地主机上成功安装日志:
$ node --version
v4.2.1
$ npm --version
2.14.7
$ npm install connect-mongo --save
|
> kerberos@0.0.16 install /Users/username/Sites/adserver/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
> node-gyp rebuild
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:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99 [-Wimplicit-function-declaration]
maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
^
1 warning generated.
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/kerberos.node
connect-mongo@0.8.2 node_modules/connect-mongo
├── depd@1.1.0
├── debug@2.2.0 (ms@0.7.1)
└── mongodb@2.0.47 (es6-promise@2.1.1, readable-stream@1.0.31, mongodb-core@1.2.20)
在EC2 Linux上安装失败安装:
$ node --version
v4.2.1
$ npm --version
2.14.7
$ sudo npm install connect-mongo
\
> kerberos@0.0.16 install /home/ec2-user/apps/adserver/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.10.40"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/ec2-user/apps/adserver/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.node-gyp"
make: Entering directory `/home/ec2-user/apps/adserver/node_modules/connect-mongo/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 `/home/ec2-user/apps/adserver/node_modules/connect-mongo/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/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 4.1.7-15.23.amzn1.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ec2-user/apps/adserver/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
gyp ERR! node -v v0.10.40
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm WARN optional dep failed, continuing kerberos@0.0.16
connect-mongo@0.8.2 node_modules/connect-mongo
├── depd@1.1.0
├── debug@2.2.0 (ms@0.7.1)
└── mongodb@2.0.47 (readable-stream@1.0.31, es6-promise@2.1.1, mongodb-core@1.2.20)
[ec2-user@ip-172-31-9-139 adserver]$