创建nuxt3项目:npx nuxi@latest init nuxt3-project
报错:
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文件添加如下配置:
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
- Windows系统hosts文件一般在:C:\Windows\System32\drivers\etc\hosts 路径
- Mac系统在终端运行:
sudo vi /etc/hosts
修改hosts即可