按照官網初始化nuxt3專案時:
輸入命令 npx nuxi init nuxt3demo
發現會失敗報錯:
getaddrinfo ENOENT raw.githubusercontent.com 報錯
解決方案:
-
手動clone代碼
git clone -b v3 https://github.com/nuxt/starter.git -
點擊報錯提示的url,在打開里面tar路徑,會自動下載,解壓即可,
前面兩種是繞路方案,下面這種是解決報錯方案:
- 為電腦添加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復制到不需要權限的其他檔案目錄,修改后再覆寫原先目錄的檔案,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/545357.html
標籤:其他
