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

无代理环境下npm安装React依赖报错ECONNREFUSED求助

Fixing ECONNREFUSED Error When Installing Webpack via npm (No Proxy Environment)

Hey there, let's figure out why you're hitting this ECONNREFUSED error even in a proxy-free environment. The key clue here is that your npm is trying to connect to 127.0.0.1:8000 when requesting the npm registry—this means leftover proxy configurations are still forcing npm to route traffic through a local proxy that doesn't exist.

Here's how to resolve this step by step:

  • First, check your current npm configs
    Run this command to see all active npm configurations:

    npm config list
    

    Look for entries like proxy, https-proxy, or http-proxy—these are likely still set from a previous proxy environment.

  • Clear leftover proxy settings
    Delete any proxy-related configs with these commands:

    npm config delete proxy
    npm config delete https-proxy
    npm config delete http-proxy
    
  • Reset npm to use the official registry
    Ensure your npm is pointing to the official registry (use HTTPS for better reliability):

    npm config set registry https://registry.npmjs.org/
    
  • Check system environment variables
    Sometimes proxy settings live in system environment variables. On Windows:

    1. Open System Properties → Advanced → Environment Variables
    2. Look for HTTP_PROXY or HTTPS_PROXY entries
    3. Delete them if present, then restart your command prompt/terminal
  • Clear npm cache (if needed)
    If you still run into issues, clear the npm cache to remove any stale data:

    npm cache clean --force
    

After completing these steps, try running your original install command again:

npm install webpack webpack-dev-server --save-dev

Why this happens

Even if you're in a proxy-free environment now, npm might still retain proxy configurations from past use. These settings force npm to send registry requests through a local proxy (127.0.0.1:8000 in your case) that isn't running, leading to the connection refused error.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 08:03:27