1

After using the computer for a while I cant use npm install anymore. If I restart the computer then all gets back to working. I am using macOS Mojave 10.14.3 with node v11.12.0 and npm 6.9.0.

Tried the solutions here: npm not working - "read ECONNRESET" but no success

npm i faker
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/faker 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 ERR! A complete log of this run can be found in:
npm ERR!     /Users/flaviomelo/.npm/_logs/2019-03-28T12_25_35_242Z-debug.log
Flávio Melo
  • 13
  • 1
  • 4

3 Answers3

1

It is always possible that for a few minutes, NPM was down - so try again now just in case.

But in general, I would start by trying to find where the problem lies.

Try this:

curl https://registry.npmjs.org/faker

That should produce pages and pages of JSON. If it doesn't, then it's possible that your terminal - for whatever reason - cannot access the internet. Comments below this answer have further steps you can try in debugging this.

If it does produce lots of JSON, then there is a problem in your version of NPM / node. As these seem to be the latest, try downgrading each to see if it's a new bug.

user208769
  • 2,216
  • 1
  • 18
  • 27
  • Thanks for your reply. So I tried using it and I get "curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to registry.npmjs.org:443". Will keep investigating. – Flávio Melo Mar 28 '19 at 14:05
  • What happens if you try it in a browser? Also, can you tell us what IP address `ping registry.npmjs.org` is giving you? Sounds like either something on the network is hijacking that call (possibly legitimately, to prevent people accidentally pushing top-secret npm modules up) or your computer doesn't have the necessary SSL root certificates to connect with – user208769 Apr 03 '19 at 09:34
  • Hello, I didn't try on the browser on that day but today it's showing the JSON like you suggested. The problem was temporary apparently. The **ping registry.npmjs.org** gives me 104.16.25.35. Thanks for your help. Should this question be marked as resolved or something? – Flávio Melo Apr 03 '19 at 15:54
  • @FlávioMelo I guess so! Glad it's working again though :) – user208769 Apr 04 '19 at 08:39
0

Today I am facing the same issue, and take me hours tried to fixed this issue, for me, it is the network issue about fetching from official, I switched to another registry like this(I am using pnpm):

pnpm config set registry https://registry.npm.taobao.org/

works for me, hope this idea could save your time.

Dolphin
  • 29,069
  • 61
  • 260
  • 539
-1

you can try these solutions

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/
Muhammad Numan
  • 23,222
  • 6
  • 63
  • 80