I am getting the following error while creating a new Angular project using Angular CLI.
ng new <project-name>
npm WARN registry Unexpected warning for http://registry.npmjs.org/: Miscellaneous Warning ECONNRESET: request to http://registry.npmjs.org/@types%2fjasmine failed, reason: socket hang up
npm WARN registry Using stale package data from http://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to http://registry.npmjs.org/jsesc failed, reason: socket hang up
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
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! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-01-23T15_11_33_289Z-debug.log
Package install failed, see above.
Package install failed, see above.
This could be because I am behind a corporate proxy. So I tried editing npm config file.
I used npm config set proxy http://proxyhostname:proxyport
and npm config set https-proxy http://proxyhostname:proxyport
.
But still, I was facing the same issue. When I opened the npm config file using npm config edit
, I realised that the above commands for proxy settings are just adding two lines at the top of the npm config file but below it still has proxy=null
and https-proxy=null
. So I tried editing the file manually. Changed proxy=null
to proxy=http://proxyhostname:proxyport
and https-proxy=null
to https-proxy=http://proxyhostname:proxyport
. I didn't get any error while saving it but when I opened the file again with npm config edit
I see that my manual changes are not present. Is there any step that I am missing to manually change the npm config file? Also, suggest if there is a different solution to the problem (mentioned above) I am facing.