按照官網初始化nuxt3項目時: 輸入命令 npx nuxi init nuxt3demo 發現會失敗報錯: getaddrinfo ENOENT raw.githubusercontent.com 報錯 解決方案: 手動clone代碼 git clone -b v3 https://github. ...
按照官網初始化nuxt3項目時:
輸入命令 npx nuxi init nuxt3demo
發現會失敗報錯:
getaddrinfo ENOENT raw.githubusercontent.com 報錯
解決方案:
前面兩種是繞路方案,下麵這種是解決報錯方案:
- 為電腦添加hosts
-
在https://www.ipaddress.com/中查詢raw.githubusercontent.com的真實ip
-
windows系統 找到C:\Windows\System32\drivers\etc 下的hosts文件,用管理員許可權打開。(無法修改請查看文章最後ps)
-
mac系統 終端輸入
sudo vim /ect/hosts
-
將下麵配置追加到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
保存重新打開終端,輸入命令 npx nuxi init nuxt3demo
進行正常下載。
ps: windows系統改hosts可能會出現無法修改的問題,可以先把hosts複製到不需要許可權的其他文件目錄,修改後再覆蓋原先目錄的文件。