1
votes

I have installed nodejs and trying to install agular-cli on windows7. Below is the command used to install.

npm install -g angular-cli

When installing angular-cli, its throwing the below error message:

This is most likely not a problem with npm itself and is related to network connectivity.
In most cases you are behind a proxy or have bad network settings.

enter image description here

I tried the below command too, but still facing the same issue.

npm cache clean
npm install -g -f angular-cli

I have gone through many documents and posts to resolve this issue, but unable to resolve. I want to work with IntelliJ and angular2.

I've tried it on multiple machines and get the same error.

--EDITED--

I tried to run the commands as administrator, but still facing the same above mentioned error.I have set the registry using the below command.

>npm set registry https://registry.npmjs.org/
>npm install -g angular-cli

Few things I noticed:

1) Could not able to ping ping 8.8.8.8 - It says Request timed out.

2) Could not able to ping 'ping registry.npmjs.org' - It says Request timed out.

3) I can connect via https in browser, https://registry.npmjs.org/

Do I need to set proxy settings to solve this issue, if so how to set? Any suggestions would be helpful.

1
Have you tried running your command prompt as administrator?Joe Clay
Yes, I tried running command prompt as administrator, but still facing the same issue mentioned above. Any suggestions, thanks. @JoeClayjavaUser
Are you behind proxy? What is content of .npmrc in user home directory? Please also follow the steps from stackoverflow.com/a/39593148/2708895Krzysztof Safjanowski

1 Answers

0
votes

According to the error messages you've got two issues.

The first, you're not running as administrator, which is why it's showing an EPERM error and it can't write to C:\program files\nodejs\npm-debug.log.

To run as administrator, right click the cmd.exe icon and choose run as administrator from the menu. It should says "Administrator" in the titlebar of the cmd window.

The second issue is a timeout, denoted by the ETIMEOUT. This means that it's taking too long for NPM to connect to the servers. This means you either tried this during one of the rare times the NPM servers went down, or you're behind a proxy.

If you're behind a proxy, you need to either reconfigure your router or configure NPM to work through proxies.

Further discussion about this issue on github: https://github.com/npm/npm/issues/8293

Many people seem to be reporting that their network is set to private or that their router's firewall doesn't allow npm through. Others are reporting that setting the npm registry explicitly helped:

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