2014-02-19 48 views
2

我想在我的Windows終端安裝快車按照快遞網站引導錯誤安裝明示或者使用的package.json文件或不使用的package.json文件

1首先提到的指令,我創建了一個目錄節點並在該package.json文件中。

我的package.json如下

{ 
    "name": "hello-world", 
    "description": "hello world test app", 
    "version": "0.0.1", 
    "private": true, 
    "dependencies": { 
    "express": "3.x" 
    } 
} 

然後我試圖運行命令

npm install 

但收到以下錯誤

E:\myFindings\nodejs_programs\node>npm install 
npm http GET https://registry.npmjs.org/express 
npm http GET https://registry.npmjs.org/express/-/express-3.4.8.tgz 
npm ERR! Error: tunneling socket could not be established, cause=connect ETIMEDOUT 
npm ERR!  at ClientRequest.onError (C:\Program Files\nodejs\node_modules\npm\node_modules\request\tunnel.js:161:17) 
npm ERR!  at ClientRequest.g (events.js:185:14) 
npm ERR!  at ClientRequest.EventEmitter.emit (events.js:88:17) 
npm ERR!  at Socket.socketErrorListener (http.js:1320:9) 
npm ERR!  at Socket.EventEmitter.emit (events.js:88:17) 
npm ERR!  at Socket._destroy.self.errorEmitted (net.js:329:14) 
npm ERR!  at process.startup.processNextTick.process._tickCallback (node.js:244:9) 
npm ERR! { [Error: tunneling socket could not be established, cause=connect ETIMEDOUT] code: 'ECONNRESET' } 
npm ERR! You may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 

npm ERR! System Windows_NT 6.1.7601 
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! cwd E:\myFindings\nodejs_programs\node 
npm ERR! node -v v0.8.0 
npm ERR! npm -v 1.1.32 
npm ERR! code ECONNRESET 
npm ERR! message tunneling socket could not be established, cause=connect ETIMEDOUT 
npm ERR! Error: socket hang up 
npm ERR!  at createHangUpError (http.js:1253:15) 
npm ERR!  at Socket.socketCloseListener (http.js:1304:23) 
npm ERR!  at Socket.EventEmitter.emit (events.js:88:17) 
npm ERR!  at Socket._destroy.destroyed (net.js:358:10) 
npm ERR!  at process.startup.processNextTick.process._tickCallback (node.js:244:9) 
npm ERR! { [Error: socket hang up] code: 'ECONNRESET' } 
npm ERR! You may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 

npm ERR! System Windows_NT 6.1.7601 
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! cwd E:\myFindings\nodejs_programs\node 
npm ERR! node -v v0.8.0 
npm ERR! npm -v 1.1.32 
npm ERR! code ECONNRESET 
npm ERR! message socket hang up 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  E:\myFindings\nodejs_programs\node\npm-debug.log 
npm ERR! not ok code 0 

我無法理解是這個問題,請幫我整理一下

我甚至嘗試安裝快遞不使用以.json文件,但得到了同樣的錯誤我NPM配置列表

內容

E:\myFindings\nodejs_programs\node>npm config list 
; cli configs 

; userconfig C:\Users\sudipkumars\.npmrc 
https-proxy = "http://sudip:[email protected]:8086/" 
proxy = "http://sudip:[email protected]:8086/%20strict-ssl%20=%20false" 
registry = "https://registry.npmjs.org/" 

; builtin config C:\Program Files\nodejs\node_modules\npm\npmrc 
prefix = "C:\\Users\\sudipkumars\\AppData\\Roaming\\npm" 

; node install prefix = C:\Program Files 
; node bin location = C:\Program Files\nodejs\\node.exe 
; cwd = E:\myFindings\nodejs_programs\node 
; HOME = C:\Users\sudipkumars 
; 'npm config ls -l' to show all defaults. 

我想你的建議

NPM配置組註冊表http://registry.npmjs.org/

and output is

E:\myFindings\nodejs_programs\node>npm install express 
npm http GET http://registry.npmjs.org/express 
npm http 304 http://registry.npmjs.org/express 
npm http GET http://registry.npmjs.org/express/-/express-3.4.8.tgz 
npm ERR! Error: getaddrinfo ENOENT 
npm ERR!  at errnoException (dns.js:31:11) 
npm ERR!  at Object.onanswer [as oncomplete] (dns.js:123:16) 
npm ERR! { [Error: getaddrinfo ENOENT] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo' } 
npm ERR! You may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 
+0

代理解決了這個問題?可以這是答案http://stackoverflow.com/questions/17324438/bower-error-tunneling-socket-could-not-be-established-cause-parse-error –

回答

0

運行以下命令

npm install express 
3

在認識問題方面。問題在於您的計算機不能夠建立連接:https://registry.npmjs.org/express/-/express-3.4.8.tgz

它正在嘗試使用HTTP GET方法來檢索在NPM註冊表中的服務器上的文件,但它似乎是超時:

npm http GET https://registry.npmjs.org/express/-/express-3.4.8.tgz 
npm ERR! Error: tunneling socket could not be established, cause=connect ETIMEDOUT 

這可能有幾個原因,但我會提到兩個主要原因:

  1. 停機時間npmjs.org,用http://status.npmjs.org/
  2. 很容易地檢查你身後代理防止這種

看你的NPM配置:

  • 除非你有一個叫代理,那麼這將無法正常工作的代理設置。所以,清除代理變量設置
  • 設置使用npm config set strict-ssl false
  • 如果這兩個不工作,嘗試設置註冊表來使用通過npm config set registry http://registry.npmjs.org/
+0

我甚至試圖設置代理,仍然效果,並且在支持站點給出的所有解決方案都是針對linux環境的 – Sudip7

+0

'npm config list'的輸出是什麼?發佈到一個pastebin。 – John

+0

我把我的問題下面的npm配置列表的結果,它檢查它。我不知道我的代理設置是否正確,因爲我不知道如何設置代理。 – Sudip7

0

工作圍繞一個非加密連接SSL嚴格爲false:npm config set registry= http://registry.npmjs.org/效果很好。

+0

爲了將來的參考,我會建議大家不要使用這種方法,因爲你很容易受到中間人攻擊,使用HTTP下載NPM回購。 – John

1

我發出以下命令

npm config set proxy false 
npm cache clean 
相關問題