2015-10-29 84 views
2

我無法在我的EC2實例上安裝connect-mongo。與node-gyp無法訪問「/root/.node-gyp/0.10.40」有關 - 這是因爲安裝的Node版本是4.2.1。Amazon EC2上的Node-gyp Connect-mongo Linux

文件夾「/root/.node-gyp/」甚至不會退出系統。那麼爲什麼node-gyp在那裏?

配置服務器時,我首先安裝了節點0.10.40,然後升級到4.2.1。

我們如何將node-gyp指向正確的目錄?還是其他地方的問題?

成功登錄安裝本地主機上:從

$ node --version 
v4.2.1 
$ npm --version 
2.14.7 

$ npm install connect-mongo --save 
| 
> [email protected] 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 
[email protected] node_modules/connect-mongo 
├── [email protected] 
├── [email protected] ([email protected]) 
└── [email protected] ([email protected], [email protected], [email protected]) 

登錄失敗安裝在EC2上的Linux:

$ node --version 
v4.2.1 
$ npm --version 
2.14.7 

$ sudo npm install connect-mongo 
\ 
> [email protected] 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 [email protected] 
[email protected] node_modules/connect-mongo 
├── [email protected] 
├── [email protected] ([email protected]) 
└── [email protected] ([email protected], [email protected], [email protected]) 
[[email protected] adserver]$ 
+0

我有同樣的問題也是如此。我甚至在我的配置中使用了這些命令(http://pastebin.com/8jWeMZUV)。 – kapitanluffy

+0

那麼它對你有用嗎?還是仍然卡住? – ChrisRich

+0

仍然卡住,我所做的是每次重建環境 – kapitanluffy

回答

1

的問題是不是與gyp WARN EACCESS ...消息。這只是一個警告,npm可以繼續解決。但要擺脫此警告消息,請參閱this link

問題在於:

./lib/kerberos.h:5:27: fatal error: gssapi/gssapi.h: No such file or directory 
#include <gssapi/gssapi.h> 

我發現這個link和解決方案(在Ubuntu/Debian的)似乎是:

sudo apt-get install libkrb5-dev