Npm install总是返回所有包的`code ECONNREFUSED`错误

时间:2017-08-13 13:19:58

标签: javascript node.js npm

`npm ERR! code ECONNREFUSED
 npm ERR! errno ECONNREFUSED
 npm ERR! FetchError: request to http://registry.npmjs.org/body-parser failed, reason: connect ECONNREFUSED 127.0.0.1:3000`

我尝试了proxy settingsregistry set commands ..但仍然没有用..

我正在使用node js最新版本..我的app监听端口是3000

我试过npm config List ..有没有错配置?

 `; cli configs
 metrics-registry = "https://registry.npmjs.org/"
  scope = ""
 user-agent = "npm/5.3.0 node/v8.1.4 win32 ia32"

; userconfig C:\Users\JANEN\.npmrc
https-proxy = "http://proxy.company.com:8080/"
proxy = "http://proxy.company.com:8080/"
registry = "https://registry.npmjs.org/"

; builtin config undefined
prefix = "C:\\Users\\JANEN\\AppData\\Roaming\\npm"

 ; node bin location = C:\Program Files (x86)\nodejs\node.exe
; cwd = C:\project\authenticationIntro-master
; HOME = C:\Users\JANEN
; "npm config ls -l" to show all defaults.

`

1 个答案:

答案 0 :(得分:0)

如果您在公司代理后面,则可能由于用户身份验证失败而拒绝连接。

将代理地址更改为"http://username:password@proxy.company.com:port"

这有望解决您的问题。