NPM doesn't install any modules: network socket hangs up

后端 未结 8 1837
醉酒成梦
醉酒成梦 2020-11-30 01:26

Salam (means Hello) :)

I have the latest version of node.js installed on ubuntu 12.04, I\'m not behind any proxies, and my network settings are correctly configured,

相关标签:
8条回答
  • 2020-11-30 01:49

    i had same problem. it seems that there is some problem with ISP's https handling. doing:

    npm config set registry http://registry.npmjs.org/
    

    worked for me

    0 讨论(0)
  • 2020-11-30 01:49

    If you are behind a proxy that has username and password authentication, try setting the proxy as

    npm config set proxy http://username:encodedpassword@proxyaddress:port

    npm config set https-proxy http://username:encodedpassword@proxyaddress:port

    0 讨论(0)
  • 2020-11-30 01:49

    Add the proxy and http_proxy field with your credentials (encoded if it contains any special characters) to your .npmrc file and run npm install again. It should work.

    for example:

    proxy=http://username:passcode@proxyURL:80/ https_proxy=http://username:passcode@proxyURL:80

    0 讨论(0)
  • 2020-11-30 01:50

    I was having the same problem. Found a solution in this thread. You can see the effective proxy that npm is using by doing:

    npm config get proxy
    npm config get https-proxy
    

    If you're behinid a proxy, try this:

    mv ~/.npmrc ~/.npmrc.bak
    
    0 讨论(0)
  • 2020-11-30 01:51

    Just follow these steps before you run: npm install -g @angular/cli

    1. npm cache clean (You can even ignore if it throws an error)
    2. npm config set strict-ssl false
    3. npm config set proxy http://myusername:mypassword@proxyaddress:port
    4. npm config set https-proxy http://myusername:mypassword@proxyaddress:port
    0 讨论(0)
  • 2020-11-30 01:54

    I was having a similar issue with my windows machine and i fixed it by first checking whether my proxy got some value by executing the below command.

    npm config get proxy
    

    in return i got the below:

    http://usr:pwd@host/:port
    

    So if anyone who is not under a proxy layer first set the proxy as null by executing the below command.

    npm config set proxy null
    

    now if you excecute your npm i it should not throw any network error.

    0 讨论(0)
提交回复
热议问题