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

执行yarn create next-app时tunneling socket建立失败问题求助

问题描述

按照nextjs官方指南执行yarn create next-app firstapp创建项目时,在Git Bash中反复报错。Node.js版本为v14.17.5,确认未使用代理,但多次尝试仍失败。报错信息如下:

$ yarn create next-app firstapp
yarn create v1.22.19
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/create-next-app: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 8889".
info If you think this is a bug, please open a bug report with the information provided in "C:\Users\username\AppData\Local\Yarn\Data\global\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

解决方案
  • 检查并清除Yarn的代理配置:
    先执行命令查看当前代理设置:
    yarn config get proxy
    yarn config get https-proxy
    
    如果返回结果里包含8889端口的地址,执行以下命令清除:
    yarn config delete proxy
    yarn config delete https-proxy
    
  • 检查系统环境变量中的代理残留:
    在Git Bash中执行:
    echo $HTTP_PROXY
    echo $HTTPS_PROXY
    echo $http_proxy
    echo $https_proxy
    
    若输出里有带8889的代理地址,临时取消这些变量:
    unset HTTP_PROXY
    unset HTTPS_PROXY
    unset http_proxy
    unset https_proxy
    
    要永久移除的话,去系统环境变量设置里删除相关条目即可。
  • 切换Yarn镜像(备选方案):
    可以把Yarn的registry换成国内镜像试试:
    yarn config set registry https://registry.npmmirror.com
    
    设置完成后重新执行yarn create next-app firstapp。
  • 重启终端和网络:
    清除代理配置后,关闭当前Git Bash窗口,重新打开再尝试创建项目。

内容的提问来源于stack exchange,提问作者Ekatama Ilham Prayoga

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.19 13:20:28