npm Unable to Install angular-cli

后端 未结 6 1999
南旧
南旧 2021-01-14 13:59

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 s

相关标签:
6条回答
  • 2021-01-14 14:19

    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.

    0 讨论(0)
  • 2021-01-14 14:19

    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.

    0 讨论(0)
  • 2021-01-14 14:19

    I faced similar issues and figured that we need to combine the proxy and the install command together like below and it worked for me. Hope it works for you people. Thanks!!

    npm --proxy http://username:password@proxyURL:port install -g @angular/cli --without-ssl --insecure

    0 讨论(0)
  • 2021-01-14 14:21

    Future viewers: Try below approach (it worked for me)

    Go to nodejs installed location (path may be different in your case)
    C:\Program Files\nodejs\node_modules\npm

    Add below entry in the npmrc file then save it

    strict-ssl=false
    

    Then try installing angular cli

    npm install -g @angular/cli
    
    0 讨论(0)
  • 2021-01-14 14:34

    This kind of issues usually happen when you are behind a proxy or a firewall that blocks npm from fetching the requested packaged.

    If you know your proxy address and port, open a console and set your HTTP_PROXY and HTTPS_PROXY variables before running npm, as follows:

    set HTTP_PROXY = "http://<proxy server name or IP address>:<proxy port>"
    set HTTPS_PROXY = ... ;same as above 
    
    npm install <package_name>
    
    0 讨论(0)
  • 2021-01-14 14:45

    You need to override your proxy settings to install angular CLI. Try executing below command :

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

    This will override your proxy and you do not need to make any changes to your connections or firewall. Once this command executes successfully try installing angular CLI using below command:

    npm install -g @angular/cli
    

    Refer this link for more details on this.

    This solved problems for me. Hope this helps!

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