2015-08-25 87 views
0

当我运行node app.js,我得到:错误正在运行的节点,NPM安装PG错误和GYP错误

Error: Cannot find module '/home/jchan1/projects/versiv-api/node_modules/pg/lib/native/../../build/default/binding' 
    at Function.Module._resolveFilename (module.js:338:15) 
    at Function.Module._load (module.js:280:25) 
    at Module.require (module.js:364:17) 
    at require (module.js:380:17) 
    at Object.<anonymous> (/home/jchan1/projects/versiv-api/node_modules/pg/lib/native/index.js:17:13) 
    at Module._compile (module.js:456:26) 
    at Object.Module._extensions..js (module.js:474:10) 
    at Module.load (module.js:356:32) 
    at Function.Module._load (module.js:312:12) 
    at Module.require (module.js:364:17) 

由于上述错误了一些关于pg,我做了一个npm install pg,但是这是我得到的错误:

[email protected] ^___^V: $ npm install pg 
/
> [email protected] install /home/jchan1/projects/versiv-api/node_modules/pg 
> node-gyp rebuild || (exit 0) 

gyp WARN install got an error, rolling back install 
gyp ERR! configure error 
gyp ERR! stack Error: 503 status code downloading tarball 
gyp ERR! stack  at Request.<anonymous> (/home/jchan1/.nvm/v0.10.33/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:246:14) 
gyp ERR! stack  at Request.emit (events.js:117:20) 
gyp ERR! stack  at Request.onResponse (/home/jchan1/.nvm/v0.10.33/lib/node_modules/npm/node_modules/request/request.js:1085:10) 
gyp ERR! stack  at ClientRequest.g (events.js:180:16) 
gyp ERR! stack  at ClientRequest.emit (events.js:95:17) 
gyp ERR! stack  at HTTPParser.parserOnIncomingClient (http.js:1692:21) 
gyp ERR! stack  at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23) 
gyp ERR! stack  at Socket.socketOnData (http.js:1587:20) 
gyp ERR! stack  at TCP.onread (net.js:527:27) 
gyp ERR! System Linux 3.13.0-39-generic 
gyp ERR! command "node" "/home/jchan1/.nvm/v0.10.33/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /home/jchan1/projects/versiv-api/node_modules/pg 
gyp ERR! node -v v0.10.33 
gyp ERR! node-gyp -v v1.0.1 
gyp ERR! not ok 
[email protected] node_modules/pg 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
└── [email protected] ([email protected]) 

我在Ubuntu 14.04使用node v0.10.33,python2.7,并有build-essentialsmakeg++安装。

[email protected] ^___^V: $ nvm list 
     v0.10.25 
->  v0.10.33 
     system 
default -> v0.10.33 
node -> stable (-> v0.10.33) (default) 
stable -> 0.10 (-> v0.10.33) (default) 
iojs -> iojs- (-> N/A) (default) 
[email protected] ^___^V: $ npm -v 
1.4.28 
[email protected] ^___^V: $ nodejs -v 
v0.10.33 
[email protected] ^___^V: $ node -v 
v0.10.33 
[email protected] ^___^V: $ make -v 
GNU Make 3.81 
Copyright (C) 2006 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. 
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE. 

This program built for x86_64-pc-linux-gnu 
[email protected] ^___^V: $ g++ --version 
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2 
Copyright (C) 2013 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
+0

它说了一些关于'503错误'这意味着'服务不可用'。你有没有再试一次?如果没有,尝试回来的新闻..(我只是尝试'npm安装pg'没有错误) –

+0

我再次尝试,它仍然无法正常工作。看起来像'503'不是临时的... – Jack

+0

你有与其他模块相同的问题吗? –

回答

0

发现此问题。我在使用NAT的虚拟机中运行它。一旦我切换到桥接模式,事情就起作用了。我怀疑NAT不允许某些端口,这就是浏览器工作的原因,但是npm install没有。奇怪的是,其他模块安装正确...

+0

您是否正在运行在您的机器中使用http [s]端口的任何服务(不在VM中)? –