title: Npm install : FetchError: request to http://registry.npmjs.org/... failed, reason: read ECONNRESET
body: <p>Trying to install any node package using npm hangs for about 5 mins then gives a ECONNRESET network error. I have been using npm for other projects recently and it worked fine but now will not work for any project(Including clean npm init)</p>
  
  <pre><code>npm i ws
  </code></pre>
  
  <p>This is on a Raspberry pi 3 running on my home network with no proxy requirements. All other machines both linux and windows are working fine.</p>
  
  <pre><code>npm -v = 6.4.1
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <ol>
  <li><p><code>npm i ws</code> This gives me the ECONNRESET error (See below)</p></li>
  <li><p><code>Curl https://registry.npmjs.org/</code>
  &amp; <code>Curl https://registry.npmjs.org/ws</code>
  Both return the correct json response</p></li>
  <li><p>Removing any proxy settings</p></li>
  </ol>
  
  <pre><code>    npm config rm proxy
      npm config rm https-proxy
      npm config set registry http://registry.npmjs.org/
  </code></pre>
  
  <ol start="4">
  <li>Restarting etc</li>
  </ol>
  
  <p>Full Error log:</p>
  
  <pre><code>npm i ws --save --verbose
  npm info it worked if it ends with ok
  npm verb cli [ '/home/pi/.nvm/versions/node/v8.16.0/bin/node',
  npm verb cli   '/home/pi/.nvm/versions/node/v8.16.0/bin/npm',
  npm verb cli   'i',
  npm verb cli   'ws',
  npm verb cli   '--save',
  npm verb cli   '--verbose' ]
  npm info using npm@6.4.1
  npm info using node@v8.16.0
  npm verb npm-session 0a9bedb5def7f4a1
  npm timing stage:rollbackFailedOptional Completed in 6ms
  npm timing stage:runTopLevelLifecycles Completed in 1146975ms
  npm verb type system
  npm verb stack FetchError: request to http://registry.npmjs.org/ws failed, reason: read ECONNRESET
  npm verb stack     at ClientRequest.req.on.err (/home/pi/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
  npm verb stack     at emitOne (events.js:116:13)
  npm verb stack     at ClientRequest.emit (events.js:211:7)
  npm verb stack     at Socket.socketErrorListener (_http_client.js:401:9)
  npm verb stack     at emitOne (events.js:116:13)
  npm verb stack     at Socket.emit (events.js:211:7)
  npm verb stack     at emitErrorNT (internal/streams/destroy.js:66:8)
  npm verb stack     at _combinedTickCallback (internal/process/next_tick.js:139:11)
  npm verb stack     at process._tickCallback (internal/process/next_tick.js:181:9)
  npm verb cwd /home/pi/projects/picamera/node_server
  npm verb Linux 4.19.37-v7+
  npm verb argv "/home/pi/.nvm/versions/node/v8.16.0/bin/node" "/home/pi/.nvm/versions/node/v8.16.0/bin/npm" "i" "ws" "--save" "--verbose"
  npm verb node v8.16.0
  npm verb npm  v6.4.1
  npm ERR! code ECONNRESET
  npm ERR! errno ECONNRESET
  npm ERR! network request to http://registry.npmjs.org/ws failed, reason: read ECONNRESET
  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 verb exit [ 1, true ]
  npm timing npm Completed in 1148813ms
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/pi/.npm/_logs/2019-05-10T23_28_17_769Z-debug.log
  
  </code></pre>