I'm having a problem with npm, I cant install anything. Here is the error messages:
C:\Windows\system32>npm install -g yo
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/yo
npm ERR! network read ECONNRESET
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! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "yo"
npm ERR! cwd C:\Windows\system32
npm ERR! node -v v0.10.17
npm ERR! npm -v 1.3.8
npm ERR! syscall read
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Windows\system32\npm-debug.log
npm ERR! not ok code 0
Any idea why is this? Here are my network settings and it seems I dont have any proxy configured. I also disabled all the firewalls.
Just in case...simply trying one more time worked for me. It could just be a temporary connection issue.
This can be caused by installing anything with npm using
sudo
-- this causes the files in the cache to be owned by root, resulting in this problem. You can fix it by running:sudo rm -rf ~/.npm
to remove the cache. Then try whatever you were doing again, making sure you never use
sudo
along withnpm
(or the problem may come back).Lots more information: npm throws error without sudo
I've tried almost all methods posted here and in other pages but didn't work. Here are the commands I've executed in order, which I encourage you to try because it worked for many people (but not me):
npm config rm proxy
npm config rm https-proxy
npm config set https-proxy https://username:password@proxy.company.com:6050
npm config set proxy http://username:password@proxy.company.com:6050
npm config set registry http://registry.npmjs.org/
And then trying to install the package
npm install -g express
, but it failed.However, when I tried to run
npm install npm@latest -g
it miraculously executed and installed fine!Then running
npm install -g express
again worked perfectly fine too.TL;DR: updating npm to the latest version solved the issue (currently 6.0.1)
I had the same problem on my local home network without proxy. Other answers in this thread didn't work for me. What I ended up doing was using
yarn
which can be used interchangeably withnpm
:To this day I don't know why my npm still don't work. I know for sure that it's a problem with my Wi-Fi, because when I connect to LTE internet broadcasted from my smartphone
npm install
works again. It has probably something to do with router settings (problems started when I upgraded my internet speed and ISP worker replaced my old router with a new one).npm config rm proxy
npm config rm https-proxy
works for me!
Please use this