【问题标题】:How to resolve npm ERR! code ECONNRESET while installing Angular cli如何解决 npm ERR!安装 Angular cli 时代码 ECONNRESET
【发布时间】:2022-12-14 04:24:25
【问题描述】:

我已经在我的 Windows-10 本地系统上成功安装了 nodejs。

当我这样做时:npm 版本,我得到:

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'
}

但是,正如我所做的那样:

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

我收到此错误:

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

我做了:

npm 配置 rm 代理

npm 配置 rm https 代理

但错误仍未解决。

我该如何解决这个问题?

谢谢

【问题讨论】:

    标签: node.js angular npm windows-10


    【解决方案1】:

    尝试使用 http 而不是 https,运行此命令来更改 npm 配置。

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

    在那次跑步之后

    npm install -g @angular/cli

    【讨论】:

    • @abdelia - 错误更改为:npm ERR!无法读取 null 的属性(读取“pickAlgorithm”)
    • 尝试清除缓存npm cache clear --force见link和other link
    • 这又带来了另一个错误:npm ERR!代码 ERR_SOCKET_TIMEOUT
    【解决方案2】:

    你解决了这个问题吗?我有这个问题,但在 Windows 11 中,我无法解决

    【讨论】:

      猜你喜欢
      • 2021-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-10
      • 2021-12-19
      • 2021-01-18
      相关资源
      最近更新 更多