1

我尝试了 Http 注册表并尝试了代理配置。

npm config rm proxy
npm config rm https-proxy

我的版本:

D:\Angular_code>node -v
v8.4.0

D:\Angular_code>npm -v
5.3.0

任何人都可以弄清楚这一点。我挣扎了将近一天:(


 Microsoft Windows [Version 6.1.7601]
 Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 D:\Angular_code>npm install -g live-server
npm ERR! code ECONNREFUSED

npm ERR! errno ECONNREFUSED

npm ERR! FetchError: request to http://registry.npmjs.org/live-server failed, re
ason: connect ECONNREFUSED 74.122.238.10:8080

npm ERR!     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\n
pm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-np
m\src\index.js:68:14)
npm ERR!     at emitOne (events.js:115:13)
npm ERR!     at ClientRequest.emit (events.js:210:7)
npm ERR!     at Socket.socketErrorListener (_http_client.js:401:9)
npm ERR!     at emitOne (events.js:115:13)
npm ERR!     at Socket.emit (events.js:210:7)
npm ERR!     at emitErrorNT (internal/streams/destroy.js:64:8)
npm ERR!     at _combinedTickCallback (internal/process/next_tick.js:138:11)
npm ERR!     at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR!  { FetchError: request to http://registry.npmjs.org/live-server failed,
 reason: connect ECONNREFUSED 74.122.238.10:8080
npm ERR!     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\n
pm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-np
m\src\index.js:68:14)
npm ERR!     at emitOne (events.js:115:13)
npm ERR!     at ClientRequest.emit (events.js:210:7)
npm ERR!     at Socket.socketErrorListener (_http_client.js:401:9)
npm ERR!     at emitOne (events.js:115:13)
npm ERR!     at Socket.emit (events.js:210:7)
npm ERR!     at emitErrorNT (internal/streams/destroy.js:64:8)
npm ERR!     at _combinedTickCallback (internal/process/next_tick.js:138:11)
npm ERR!     at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR!   message: 'request to http://registry.npmjs.org/live-server failed, re
ason: connect ECONNREFUSED 74.122.238.10:8080',
npm ERR!   type: 'system',

npm ERR!   errno: 'ECONNREFUSED',

npm ERR!   code: 'ECONNREFUSED',

npm ERR!   stack: 'FetchError: request to http://registry.npmjs.org/live-server
failed, reason: connect ECONNREFUSED 74.122.238.10:8080
   at ClientRequest.re
q.on.err (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\pacote\\no
de_modules\\make-fetch-happen\\node_modules\\node-fetch-npm\\src\\index.js:68:14
)
   at emitOne (events.js:115:13)\n    at ClientRequest.emit (events.js:210:7
)   at Socket.socketErrorListener (_http_client.js:401:9)\n    at emitOne (ev
ents.js:115:13)\n    at Socket.emit (events.js:210:7)\n    at emitErrorNT (inter
nal/streams/destroy.js:64:8)
   at _combinedTickCallback (internal/process/nex
t_tick.js:138:11)
   at process._tickCallback (internal/process/next_tick.js:1
80:9)' }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'


npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\626484\AppData\Roaming\npm-cache\_logs\2018-01-17T14_48_21
_042Z-debug.log
4

2 回答 2

0

尝试配置您的代理

您可以使用

npm config set proxy "http://[USERNAME]:[PASSWORD]@[HOST]:[PORT]/"
npm config set strict-ssl false
于 2018-01-17T15:09:50.593 回答
0

npm config 设置代理 http://"username:pass@word"@proxy.xxxxxx.com:portnumber

npm config set https-proxy http://"username:pass@word"@proxy.xxxxxx.com:portnumber

npm 配置设置注册表https://registry.npmjs.org/

npm set strict-ssl false

这对我有用...谢谢大家

于 2018-01-23T06:11:26.263 回答