nuxt3安装报错

创建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地址,如下:

    截屏2024-06-23 11.38.29.png

  • 然后在系统的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即可
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容