安装Nuxt遇到错误:Error: Failed to download template from registry

2026/04/07Node.js 86 阅读
使用命令 npm create nuxt nuxt-app 安装 Nuxt 遇到错误

Error: Failed to download template from registry: Failed to download https://raw.githubusercontent.com/nuxt/starter/templates/templates/module.json: TypeError: fetch failed

  1. 查询raw.githubusercontent.com 域名的服务器ip地址
  1. 将最下面的几列ip 复制 raw.githubusercontent.com

  2. 打开电脑的 :\Windows\System32\drivers\etc\hosts 文件 增加以下地址

ip1 raw.githubusercontent.com
ip2 raw.githubusercontent.com
  1. 保存hosts文件后重新运行npm create nuxt nuxt-app