npm not working - "read ECONNRESET"

node.jsNpm

node.js Problem Overview


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.

enter image description here

node.js Solutions


Solution 1 - node.js

use

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

so that npm requests for http url instead of https.

and then try the same npm install command

Solution 2 - node.js

You may want to check your NPM proxy settings and perhaps remove it.

npm config get proxy
npm config rm proxy
npm config rm https-proxy

One might expect a fresh install of NodeJS+NPM would not have a proxy configured. Strangely enough, mine did come with a proxy defined, pointing to an IP and port 3128. Removing the proxy did the trick.

Solution 3 - node.js

You may also need to specify the proxy server/port, in some environments the system settings for proxy are not enough for npm to work.

    npm config set proxy "http://your-proxy.com:80"

Solution 4 - node.js

Remove your proxy settings at home and switch on at Office networks, This may be irritating, But It worked for me:

npm config set proxy http://xxx.xxx.xxx.4:8080   
npm config set https-proxy http://xxx.xxx.xxx.4:8080

and

npm config rm proxy   
npm config rm https-proxy

Solution 5 - node.js

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 with npm (or the problem may come back).

Lots more information: https://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo/24404451#24404451

Solution 6 - node.js

Restarting my PC made it worked.

Solution 7 - node.js

npm config rm proxy

npm config rm https-proxy

works for me!

Solution 8 - node.js

Remove yarn.lock , package-lock.json, node_modules

and then

npm install -f 

Worked for me

Solution 9 - node.js

The three thing to make npm working well inside the proxy network .

This set npm registry , By default it may take https.

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

Second is two set proxy in your system . If your organization use proxy or you.

> npm config set proxy "http://username:password@proxy-url:proxy-port" > > npm config set https-proxy > "http://username:password@proxy-url:proxy-port"

You can also check if they are set or not , by

> npm config get https-proxy

for all values.

Solution 10 - node.js

I had the same issue in windows while installing any package from npm. Fixed that with - ** open command prompt as administrator and run these 3 commands **/

1. npm config rm proxy

2. npm config rm https-proxy

3. npm install npm@latest -g

FOR MAC / LINUX
1. sudo npm config rm proxy

2. sudo npm config rm https-proxy

3. sudo npm install npm@latest -g

Basically this was version isuue with npm . Please check its worrking

Solution 11 - node.js

I had the same issue but none of these solutions worked correctly. Finally, I have installed packages via yarn, which is npm-compatible. As per official website:

> Migrating from npm should be a fairly easy process for most users. > Yarn can consume the same package.json format as npm, and can install > any package from the npm registry.

Just install the yarn and then then, run the install by using the following command, the equivalent to npm install in yarn:

yarn install

Read more at—Yarn: Migrating from npm.

Solution 12 - node.js

If you're using Windows you should follow up on Advanced System Settings to check the env vars declared over there, you should notice that the proxy configuration may lie within environment variables, like in the picture below:

Windows env vars

So if your proxy server is not available or is blocking traffic from npm you might notice the aforementioned error in this topic. Maybe you don't need any proxy at all, in this case, just remove this HTTP_PROXY env variables.

I had turned all proxy configurations off in my Windows and npm settings, however, npm was still getting timeout and connection errors while downloading resources, then I figured out there was still a proxy configuration left on env variables, which was causing all the trouble.

Solution 13 - node.js

At work, i had to load up my browser and browse a webpage (which authenticates me to our web-filter). Then I retried the command and it worked successfully.

Solution 14 - node.js

This is an old question, but anyway.

I had this issue, when I was trying to deploy to heroku, and the fix that worked for me was to update the npm version that was used. I had version 2.x.x and I updated to 3.x.x

Solution 15 - node.js

You may also encounter this error if you have a saved bearer token that is now invalid. I've encountered this when using a private repo where the accounts were wiped and reset, invalidating the tokens. Although your repo may not require authentication, if you have a token from a previous login it will be passed and if it's invalid your connection will be closed.

You can resolve this by either logging in again with the new user name and password, or presumably by simply logging out via npm.

Solution 16 - node.js

I did not want to switch to http for the registry, what worked for me was downgrading from the latest Node version to the LTS version (as of now, 6.x).

Solution 17 - node.js

I had the problem with npm throwing this error.

So basically whenever error was thrown i either used manual install
from git or waited and installed specified version like:

npm install resolve@^1.1.6

when running alone:

npm install resolve

didn't worked.

I updated node.js from 7 to 8 and npm install goes smoothly.

I think that maybe the version 7 caused this problem since @luschn downgraded to 6 so he didn't use 7 too.

Maybe the registry itself is returning errors without showing problems on their status pages because after some time i could install this one breaking package and then proceed with npm install to install the rest.

Solution 18 - node.js

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 with npm:

yarn add

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).

Solution 19 - node.js

I had the same problem when trying to run npm on system emulated in Oracle VirtualBox. I resolved it by adding Google DNS address in Network Adapter properties.

Network Adapter properties > IPv4 properties > Preferred DNS address: 8.8.8.8.

Solution 20 - node.js

This is what worked for me:

proxy = http://1.1.1.1:3128/
https_proxy = http://1.1.1.1:3128/
strict-ssl = false
ca = null
registry = http://registry.npmjs.org/

Answer found here: https://fak3r.com/2015/07/31/howto-use-npm-behind-a-corporate-proxy/

Solution 21 - node.js

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:[email protected]:6050
  • npm config set proxy http://username:[email protected]: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)

Solution 22 - node.js

Our company firewall will stop installing node hence connect to the personal network and install, it worked for me.

Solution 23 - node.js

I found "npm config edit" to be more useful to update the entries for https-proxy, proxy, registry

I did something like this

  • npm config list
  • npm config edit (opens in vi)
  • Edit or set the config entries for https-proxy, proxy, registry
  • npm install

Solution 24 - node.js

Just in case...simply trying one more time worked for me. It could just be a temporary connection issue.

Solution 25 - node.js

npm config set https-proxy "http://username:password@proxy-url:proxy-port" worked for me

Solution 26 - node.js

In case this helps anyone who was in my situation: I recently installed Fiddler, which (unbeknownst to me) added a network proxy through 127.0.0.1:8866. I went into my Ubuntu network settings, clicked into the "Network Proxy" settings, and disabled it, and then all was back to normal.

So in general, check to make sure you haven't got a network proxy set up due to a side-effect of something else you were doing.

Solution 27 - node.js

I found a simple solution for this. if you are using windows 10 then go to the network setting and turn off the automatic proxy detection.it solved my problem. I was looking for this for the last 2 days.

Solution 28 - node.js

it solved for me by use this code : npm install -g yarn

yarn global add create-react-app

Solution 29 - node.js

In my case changing wifi works for me. I usually work in my living room. But I changed to my room just a few days ago. The wifi did not reach the 2nd floor so we used Wifi Extender.

Then I had this issue. I tried switching back to my living room's wifi and I got no problem from doing the same command.

Solution 30 - node.js

Solution 1:

MAC + LINUX

run this command with sudo

sudo npm install -g yo
Windows

run cmd as administrator and then run this command again

Solution 2:

run this command and then try

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOmarView Question on Stackoverflow
Solution 1 - node.jsMithun SatheeshView Answer on Stackoverflow
Solution 2 - node.jsjedizView Answer on Stackoverflow
Solution 3 - node.jsDmitri MogilevskiView Answer on Stackoverflow
Solution 4 - node.jsIgnatius AndrewView Answer on Stackoverflow
Solution 5 - node.jsKevin CooperView Answer on Stackoverflow
Solution 6 - node.jsGowthamView Answer on Stackoverflow
Solution 7 - node.jssamivicView Answer on Stackoverflow
Solution 8 - node.jsRajendra singh ranaView Answer on Stackoverflow
Solution 9 - node.jsHimanshu sharmaView Answer on Stackoverflow
Solution 10 - node.jsShivam GuptaView Answer on Stackoverflow
Solution 11 - node.jsDariusz WoźniakView Answer on Stackoverflow
Solution 12 - node.jss_bigheadView Answer on Stackoverflow
Solution 13 - node.jsPost ImpaticaView Answer on Stackoverflow
Solution 14 - node.jsDimitris KaragiannisView Answer on Stackoverflow
Solution 15 - node.jsCarthView Answer on Stackoverflow
Solution 16 - node.jsandyrandyView Answer on Stackoverflow
Solution 17 - node.jsMikeView Answer on Stackoverflow
Solution 18 - node.jsCelebesView Answer on Stackoverflow
Solution 19 - node.jsKarol TrybulecView Answer on Stackoverflow
Solution 20 - node.jsAllanView Answer on Stackoverflow
Solution 21 - node.jsNuhmanView Answer on Stackoverflow
Solution 22 - node.jssahiView Answer on Stackoverflow
Solution 23 - node.jsPrasad ParavathaView Answer on Stackoverflow
Solution 24 - node.jsalexr101View Answer on Stackoverflow
Solution 25 - node.jsOm MishraView Answer on Stackoverflow
Solution 26 - node.jsjoeView Answer on Stackoverflow
Solution 27 - node.jsEngr.Aftab UfaqView Answer on Stackoverflow
Solution 28 - node.jsZain AlabdeenView Answer on Stackoverflow
Solution 29 - node.jsIrfandy JipView Answer on Stackoverflow
Solution 30 - node.jsMuhammad NumanView Answer on Stackoverflow