安装
pnpm dlx nuxi@latest init <project-name>
-
报错:
Error: Failed to download template from registry: Failed to download https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json: TypeError: fetch failed -
无法解析域名
raw.githubusercontent.com,这通常是由于 DNS 污染造成的,可以在电脑本地做域名解析,首先在域名解析网页 解析出raw.githubusercontent.com对应的ip地址
解决方案
方案一(推荐使用)
- 在系统的hosts文件添加如下配置
- Windows系统hosts文件一般在:C:\Windows\System32\drivers\etc\hosts 路径
- Mac系统在终端运行:
sudo vi /etc/hosts修改hosts即可
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
2606:50c0:8000::154 raw.githubusercontent.com
2606:50c0:8001::154 raw.githubusercontent.com
2606:50c0:8002::154 raw.githubusercontent.com
2606:50c0:8003::154 raw.githubusercontent.com
方案二
前往github下载nuxt3安装包