javascript - 使用 npm 安装 Angular CLI 时的 ECONNRESET
问题描述
尝试在没有代理集和完美互联网的机器上安装 Angular CLI 时,我收到以下错误:
4727 silly extract micromatch@^3.1.4 extracted to C:\Users\User\AppData
\Roaming\npm\node_modules\.staging\micromatch-7d604bf4 (38763ms)
4728 timing action:extract Completed in 265532ms
4729 verbose unlock done using C:\Users\User\AppData\Roaming\npm-cache\_locks\staging-eb8de851d6fef93d.lock for C:\Users\User\AppData\Roaming\npm\node_modules\.staging
4730 timing stage:rollbackFailedOptional Completed in 0ms
4731 timing stage:runTopLevelLifecycles Completed in 277531ms
4732 verbose type system
4733 verbose stack FetchError: request to https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz failed, reason: read ECONNRESET
4733 verbose stack at ClientRequest.req.on.err
[...]
4739 error code ECONNRESET
4740 error errno ECONNRESET
4741 error network request to https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz failed, reason: read ECONNRESET
4742 error network This is a problem related to network connectivity.
4742 error network In most cases you are behind a proxy or have bad network settings.
4742 error network
4742 error network If you are behind a proxy, please make sure that the
4742 error network 'proxy' config is set properly. See: 'npm help config'
4743 verbose exit [ 1, true ]
它通常无法提取 rxjs 包。到目前为止,我已经尝试过:
- 将注册表设置为 http:// 版本,但它会更早地失败,每次在 is-number 包上
- 重新安装和更新 npm/node
- 每次操作后清除缓存
- 禁用windows防火墙
- 以管理员权限启动命令行
- 检查代理配置是否为空
似乎没有任何工作。你有什么想法?
编辑:也许这会有所帮助,但是当我尝试更新 npm 本身时,它会立即在 rollbackFailedOptional 上挂起,它只有在将注册表更改为 http:// 版本后才设法更新自己
解决方案
降级到更稳定的 node/npm 版本。要安装特定版本的 npm,例如5.6.0
:
npm install -g npm@5.6.0
推荐阅读
- python - 熊猫 agg 和 listagg 同时
- material-ui - Material-UI 中的引导间距断点相当于什么?
- php - 带有 OR 条件的 CakePHP 链自定义查找器
- javascript - AR.JS 对移动设备和角落点击事件的最终答案
- javascript - Redux,“删除对象”在嵌套对象中无法正常工作
- javascript - 我无法单击确认框中的“确认”按钮,cy.eq() 失败,因为此元素已与 DOM 分离。抛出错误
- docker - 无法从 docker compose 连接到静态 VPN
- ag-grid - 如何使用 AG Grid 和 Adaptable/ 在屏幕上显示警报
- near - 在 indexer localnet 附近运行时出错,无法生成 config.json
- gmail - 如何计算 Gmail 搜索中的项目数