npm ERR! Error: connect ECONNREFUSED

后端 未结 5 1563
深忆病人
深忆病人 2020-11-30 06:36

I\'m trying to update the npm (node package manager) using the command: npm install npm@latest -g but I\', getting the following error in the command prompt:

does

5条回答
  •  既然无缘
    2020-11-30 07:38

    I have been trying to fix this issue by

    npm config set registry http://registry.npmjs.org/
    npm config set proxy http://myproxyblabla:myport
    npm config set https-proxy http://myproxyblabla:myport
    

    But it didn't help. The only one solution which worked for me is adding additional fields to host file (C:\Windows\System32\drivers\etc\hosts)

    151.101.36.162 registry.npmjs.com
    151.101.36.162 registry.npmjs.org
    

    This allowes npm to resolve address to server from which it will download needed files. You can get familiar with closed issue on npm repository where this solution is approved by npm contributors.

提交回复
热议问题