npm ERR! Error: connect ECONNREFUSED

后端 未结 5 1573
深忆病人
深忆病人 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:29

    I got a similar error when I was using Node JS behind a proxy server. Here's what I had to do to fix it:

    npm config set proxy http://jdoe:password123@proxy.company.com:8080
    npm config set https-proxy http://jdoe:password123@proxy.company.com:8080
    

    Just replace "jdoe" and "password123" with your own credentials to access the proxy server. Everything after the @ is the server domain name, or you can enter the exact IP address too. In my case, both addresses were HTTP (not HTTPS).

    To confirm the changes, you can type:

    npm config list
    

    and your settings should be listed.

    You can get the proxy settings (address) from your browser too.

提交回复
热议问题