When I create a new Nuxt 3 project using this command:
npx nuxi init nuxt-app
It outputs this error:
ERROR (node:1752) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time 09:53:25 (Use `node --trace-warnings ...` to show where the warning was created) ERROR Failed to download template from registry: fetch failed 09:53:25 at /C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13269:11 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async downloadTemplate (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13268:20) at async Object.invoke (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13336:15) at async _main (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/cli.mjs:50:20)
My environment:
At first I suspected this was due to my network. But I don't get the error when I try to install other npm packages.
I also encountered the same error (Windows 10). Mine is very simple.
Yes, this has to do with the network or IP being blocked. I managed it though. This is what I do.
First enter
C:\Windows\System32\drivers\etc
Look for the "hosts" file in this folder. Open with notepad as administrator. Now add this line at the end of the file (along with the other IP addresses).
This should do the trick.
I found the reason here.
It is indeed a network problem. It cannot access
raw.githubusercontent.com
from the command line because it cannot find the corresponding IP address.The issue was fixed after adding the correct IP address of
raw.githubusercontent.com
to the Windows hosts file