Skip to content

解决nuxtjs安装时报错

nuxt安装是报错Error: Failed to download template from registry: Failed to download https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json: TypeError: fetch failed

在安装nuxt3搭建项目时,第一部就会报错

js
pnpm dlx nuxi@latest init nuxt-app
pnpm dlx nuxi@latest init nuxt-app

解决方法:配置hosts

Mac中路径是 /etc/hosts

js
185.199.108.133 raw.githubusercontent.com
185.199.108.133 raw.githubusercontent.com

MacBook:

第一打开终端,输入sudo vim /etc/hosts 按回车,输入密码,进入插入模式,按 i 键就可以编辑了,然后把185.199.108.133 raw.githubusercontent.com 粘贴到最后一行,按 esc 键退出插入模式(就是回到普通模式),直接输入 :wq ,就是保存更改并退出。然后就可以安装了

程序员小洛文档