You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular安装失败求助:执行npm install -g @angular/cli遇ECONNRESET错误

Fixing ECONNRESET Error When Installing Angular CLI via npm

Hey there, sorry to hear you're stuck with this frustrating network error while trying to set up Angular CLI—let's work through some targeted fixes to get you up and running.

The ECONNRESET error you're seeing means your npm request to the registry got abruptly disconnected, which almost always ties to network connectivity issues (proxy settings, unstable registry access, or blocked requests). Here are actionable steps to troubleshoot:

  • Switch to a stable npm registry mirror
    The default npm registry (registry.npmjs.org) can be slow or unreliable in some regions. Try switching to a domestic mirror first:

    npm config set registry https://registry.npmmirror.com
    

    Then re-run your install command:

    npm install -g @angular/cli
    

    If you need to switch back to the official registry later, use:

    npm config set registry https://registry.npmjs.org/
    
  • Clear misconfigured proxy settings
    Proxy configurations are a top culprit for this error. First check if npm has proxy settings enabled:

    npm config get proxy
    npm config get https-proxy
    

    If either command returns a value, delete those settings:

    npm config delete proxy
    npm config delete https-proxy
    

    Also, temporarily disable any system-level proxies, VPNs, or browser proxy extensions—they might be interfering with npm's network calls.

  • Clean corrupted npm cache
    A broken cache can cause unexpected network glitches. Wipe the cache and try again:

    npm cache clean --force
    
  • Check for firewall/antivirus interference
    Local firewalls or antivirus software often block npm's outgoing requests. Temporarily disable these tools, attempt the install, then re-enable them afterward.

  • Test registry connectivity directly
    Use curl to verify if you can reach the problematic registry endpoint:

    curl http://registry.npmjs.org/remove-trailing-separator
    

    If this command fails, your network might be blocking access to npm's registry. Try switching to a different network (like a mobile hotspot) to rule out local restrictions.

  • Update npm to the latest version
    Outdated npm versions can have known network bugs. Update npm first, then install Angular CLI:

    npm install -g npm@latest
    npm install -g @angular/cli
    

If none of these steps resolve the issue, feel free to share more details like your operating system, npm version (npm -v), and whether you're on a corporate network (which often has strict proxy rules)—that will help narrow down the problem further.

内容的提问来源于stack exchange,提问作者BlockeeR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:09:39