2015-08-25 84 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中)? –