终端安装依赖包报错error An xxxx registry.yarnpkg.xxxxx connect ETIMEDOUT解决方法

416 阅读1分钟

终端安装依赖包报错以下内容

error An unexpected error occurred: "registry.yarnpkg.com/date-fns/-/…: connect ETIMEDOUT 104.16.21.35:443". 开始切换到几个镜像都是没解决掉问题,之后解决方法是

  1. 终端更换为淘宝源 yarn config set registry https://registry.npm.taobao.org

  2. 更换完成后还报错

  3. 如安装了npm,也把npm也设置为淘宝镜像 npm config set registry https://registry.npm.taobao.org

  4. 引入antd,终端执行npm start成功