关于nuxt3创建项目失败问题

2,506 阅读1分钟
  在创建nuxt3项目中碰到一直无法拉取github远程地址的远程模板,无法通过官方提供的脚手架命令创建项目

npx nuxi init [project-name] 进行项目创建

出现的错误信息是:Error: Failed to download template from registry: fetch failed

解决方案一:通过git去拉取项目模板:

  git clone -b v3 https://github.com/nuxt/starter.git

解决方案二: 修改系统hosts文件

  修改`C:\Windows\System32\drivers\etc`路径下的hosts文件
  # Nuxt3 
  185.199.108.133 raw.githubusercontent.com
  185.199.109.133 raw.githubusercontent.com
  185.199.110.133 raw.githubusercontent.com
  185.199.111.133 raw.githubusercontent.com

创建nuxt2项目命令:yarn create nuxt-app正常使用