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

为何npx create-react-app在Git Bash中卡住,其他终端却可正常运行?

Git Bash执行npx create-react-app卡住的原因及解决办法
  • Git Bash代理配置冲突
    Git Bash可能和PowerShell/CMD使用了不同的代理设置,导致npm包下载请求被拦截。执行以下命令清除全局代理配置:

    git config --global --unset http.proxy
    git config --global --unset https.proxy
    

    之后重新运行npx create-react-app project-name。

  • npm源环境差异
    Git Bash里的npm registry源可能和PowerShell/CMD不一致,导致下载速度极慢甚至卡住。先查看当前源:

    npm config get registry
    

    如果不是国内镜像源,切换到国内加速源:

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

    再重新执行创建命令。

  • 终端交互被屏蔽
    create-react-app安装时可能需要确认协议或权限,但Git Bash的交互提示没显示出来,导致进程停滞。可以尝试两种方式:

    1. 强制使用npm安装:npx create-react-app project-name --use-npm
    2. 跳过交互检查:先执行export CI=true,再运行创建命令。
  • 全局版本与npx缓存冲突
    你全局安装的create-react-app可能和npx要拉取的最新版本存在冲突,导致Git Bash下进程卡住。先卸载全局版本:

    npm uninstall -g create-react-app
    

    然后直接用npx create-react-app project-name,让npx自动拉取适配的最新版本。

内容的提问来源于stack exchange,提问作者Lourd Nathaniel Gonzalez

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.26 16:52:02