nuxt3项目创建失败怎么办

835 阅读1分钟

官方的创建项目命令是npx nuxi init <project-name>,但发现不能创建,即便开了加速器也不行

错误提示如下,意思是无法从远程Giehub仓库拉取项目

Snipaste_2023-02-15_16-52-37.png

方法1:通过Git克隆

需要自己安装一下Git,这种最简单

# nuxt的github仓库
git clone -b v3 https://github.com/nuxt/starter.git

方法2:修改系统hosts文件

Win10系统的hosts文件存放在C:\Windows\System32\drivers\etc路径下

把文件复制一份到桌面,然后用记事本打开,在最下面增加:

# Nuxt3
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

然后保存,把桌面的文件拖回C:\Windows\System32\drivers\etc路径中,覆盖保存

这样就能通过官方的命令创建项目了

Snipaste_2023-02-15_17-03-32.png