0

I have successfully installed nodejs on my Windows-10 local system.

When I did: npm version, I got:

C:\WINDOWS\system32>npm version
{
  npm: '8.5.3',
  node: '16.14.0',
  v8: '9.4.146.24-node.20',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1m+quic',
  cldr: '40.0',
  icu: '70.1',
  tz: '2021a3',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

However, as I did:

C:\WINDOWS\system32>npm install -g @angular/cli

I got this error:

npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/ajv 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!     C:\Users\HP\AppData\Local\npm-cache\_logs\2022-03-12T11_01_57_166Z-debug-0.log

I did:

npm config rm proxy

npm config rm https-proxy

But the error is still not resolved.

How do I sort this out?

Thanks

Gbenga
  • 115
  • 1
  • 4
  • 15

3 Answers3

2

Try to use http instead of https, run this command to change the npm configuration.

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

after that run

npm install -g @angular/cli

abdella
  • 490
  • 5
  • 11
  • @abdelia - The error changed to: npm ERR! Cannot read properties of null (reading 'pickAlgorithm') – Gbenga Mar 12 '22 at 12:50
  • 1
    Try to clear cache `npm cache clear --force` see [link](https://stackoverflow.com/questions/70019872/npm-err-cannot-read-properties-of-null-reading-pickalgorithm) and [other link](https://stackoverflow.com/questions/69567381/getting-cannot-read-property-pickalgorithm-of-null-error-in-react-native) – abdella Mar 12 '22 at 13:00
  • 1
    That brings another error again: npm ERR! code ERR_SOCKET_TIMEOUT – Gbenga Mar 12 '22 at 13:18
0

I faced this issue creating a next application as well.

npm config set registry http://registry.npmjs.org/
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
0

I also faced the same problem . This only happens when running terminal through VS Code. Solutions :

1.Try running VS Code as an administrator.

2.Use default window powershell.

Both worked for me :)