node.jsnpm

npm not working - "read ECONNRESET"


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


Solution

  • Try setting the npm registry to HTTP by running:

    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.

    TL;DR:

    Looks like you are having problem with npm while trying to install packages, getting ECONNRESET error. This usually means there is some issue with network connectivity, which might be due to proxy settings or firewalls.

    To fix this issue, you can try these steps:

    1. Set npm Registry to HTTP: Sometimes using HTTPS can create problems with certain network setups, especially if there are SSL certificate issues or problems with proxy. So, you can switch to HTTP version of npm registry by running this command:

      npm config set registry http://registry.npmjs.org/
      
    2. Try Installation Again: After changing the registry, try running your install command again:

      npm install -g yo
      
    3. Check Proxy Settings: Since you said you don’t have any proxy configured, make sure npm settings also reflect that. You can check current npm proxy settings by running:

      npm config get proxy
      npm config get https-proxy
      

      If these show any value, you may want to delete them by using:

      npm config delete proxy
      npm config delete https-proxy
      
    4. Network Configuration: If still having issues, check if your network connection is stable. You can try connecting to different network or check if any firewall or antivirus is blocking npm connections.

    5. Update Node and npm: You are using very old versions of Node.js and npm. If possible, try to update to latest versions.

    6. Check Logs: If problem still continues, look at the log file mentioned in error message (C:\Windows\system32\npm-debug.log) for more details about error.