npm Unable to Install angular-cli

23,551

Solution 1

Yes, this can be caused either by a firewall or a proxy. Can you ping the npm registry host and fetch a simple file?

> ping registry.npmjs.org
> npm view npm version

If the ping is not successful, check your connection or disable your firewall.

Solution 2

Setp-1: open windows command prompt then type following command to get the IP address of your proxy server

ping your-proxy-name

For example:

ping myproxy.xyz.com

Step-2: open Node.js command prompt and type following command

npm config set http-proxy http://your-proxy-ip-retrieved-in-step-1:port
npm config set https-proxy http://your-proxy-ip-retrieved-in-step-1:port

For example:

npm config set http-proxy http://192.168.192.95:8080
npm config set https-proxy http://192.168.192.95:8080

Setp-3: on Node.js command prompt type following command to install angular

npm install -g @angular/cli

Hope it will work for you.

Share:
23,551
Ram Chandran
Author by

Ram Chandran

Updated on September 11, 2020

Comments

  • Ram Chandran
    Ram Chandran over 3 years

    I am trying to install angular-cli via npm. I have the recent version of Nodejs and git installed. I am not behind any proxy server(verified it through netsh winhttp show proxy as well as through Internet Explorer LAN settings) and there is no problem with my internet connection. When i try to run

    npm install -g angular-cli then I get the following error

    C:\Windows\system32>npm install -g angular-cli
    npm ERR! Windows_NT 6.1.7601
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
    node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "angular-cli"
    npm ERR! node v7.3.0
    npm ERR! npm  v3.10.10
    npm ERR! code ETIMEDOUT
    npm ERR! errno ETIMEDOUT
    npm ERR! syscall connect
    
    npm ERR! network connect ETIMEDOUT 151.101.192.162:80
    npm ERR! network This is most likely not a problem with npm itself
    npm ERR! network and is related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad network settin
    gs.
    npm ERR! network
    npm ERR! network If you are behind a proxy, please make sure that the
    npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     C:\Windows\system32\npm-debug.log
    

    I tried cleaning the cache through npm cache clean and also tried to change the registry to http:\ via

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

    I also tried uninstalling nodejs and reinstalling it again but it is not working. I am getting the same error. Any ideas.

  • Ram Chandran
    Ram Chandran over 7 years
    I am not able to ping registry.npmjs.org. The request timed out.
  • Badr Bellaj
    Badr Bellaj over 7 years
    so you have a connection issue
  • Badr Bellaj
    Badr Bellaj over 7 years
    i've tried it now and its work on my machine so disable your firewall or check your connection is it okey
  • Ram Chandran
    Ram Chandran over 7 years
    Running npm view npm version resulted in the same error as above. So this could be a firewall issue?
  • Badr Bellaj
    Badr Bellaj over 7 years
    possible, are you using a proxy? try to use tracert registry.npmjs.org to check the rooting process
  • Ram Chandran
    Ram Chandran over 7 years
    Thanks. I think the problem was with the connection. I disabled the firewall but it didn't work. Used a different ISP to connect to the internet and now the installation was successful.
  • hozefam
    hozefam about 5 years
    This worked for me as my corporate proxy was blocking the npm registry url.
  • Brijesh Kumar Tripathi
    Brijesh Kumar Tripathi about 5 years
    I am happy to know that it worked for you. Thanks for your comment!