➜ nuxt-in-action npx nuxi init nuxt3-app
Nuxi 3.0.0
ERROR Failed to download template from registry: request to
https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json failed,
reason: connect ECONNREFUSED 0.0.0.0:443
这是因为nuxi在创建项目时需要到raw.githubusercontent.com拉取项目模版,由于域名解析失败导致创建流程失败。解决方案也很简单,我们可以获取这个网址的ip地址,并在/etc/hosts中配置好,这样就能够顺利拉取项目模版,并成功创建项目。
我们访问 ipaddress.com,找到下面 IPv4 Addresses,例如:185.199.108.133
然后添加该 ip 地址到 hosts,mac下 hosts 配置路径:/etc/hosts。
sudo vi /etc/hosts
新增一行,185.199.108.133 raw.githubusercontent.com。
其他情况:
- 如果你是 windows 电脑,可以自行搜索:windows 如何修改 hosts 文件;
- 如果不想尝试或还是失败,可以直接克隆我们的范例项目即可。