npm installation error connect ECONNREFUSED 127.0.

2019-04-16 15:32发布

问题:

ive just started working on my first node JS app, while trying to install express through npm, i was getting te following error :

 Error: connect ECONNREFUSED 127.0.0.1:8080
     at Object.exports._errnoException (util.js:870:11)
     at exports._exceptionWithHostPort (util.js:893:20)
     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1057:14)
  { [Error: connect ECONNREFUSED 127.0.0.1:8080]
   code: 'ECONNREFUSED',
   errno: 'ECONNREFUSED',
   syscall: 'connect',
   address: '127.0.0.1',
   port: 8080 }

and at npm-debug :

36 verbose stack Error: connect ECONNREFUSED 127.0.0.1:8080
36 verbose stack     at Object.exports._errnoException (util.js:870:11)
36 verbose stack     at exports._exceptionWithHostPort (util.js:893:20)
36 verbose stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1057:14)
37 verbose cwd C:\APS\NodeJS
38 error Windows_NT 6.1.7601
39 error argv "C:\\APS\\NodeJS\\node.exe" "C:\\APS\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "express"
40 error node v4.4.0
41 error npm  v2.14.20
42 error code ECONNREFUSED
43 error errno ECONNREFUSED
44 error syscall connect
45 error Error: connect ECONNREFUSED 127.0.0.1:8080
45 error     at Object.exports._errnoException (util.js:870:11)
45 error     at exports._exceptionWithHostPort (util.js:893:20)
45 error     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1057:14)
45 error  { [Error: connect ECONNREFUSED 127.0.0.1:8080]
45 error   code: 'ECONNREFUSED',
45 error   errno: 'ECONNREFUSED',
45 error   syscall: 'connect',
45 error   address: '127.0.0.1',
45 error   port: 8080 }
46 error If you are behind a proxy, please make sure that the
46 error 'proxy' config is set properly.  See: 'npm help config'
47 verbose exit [ 1, true ]

i looke for tat issue and couldnt find somthing , if anyone that faced such an issue can help ill appriciate it. TNX

回答1:

Issue solved

The error was by wrong configuration of proxy on one of my attempts probably. What helped me was: npm install not work

I did the following :

  1. npm config set proxy null npm config set https-proxy null
  2. npm config set registry http://registry.npmjs.org/

Thanks for everyone trying to help