An error occurred while creating the nuxt3 project. Unable to download template from registry
P粉469090753
P粉469090753 2023-11-01 23:50:03
0
2
714

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:

  • Operating system: Windows 11
  • Node version: 18.12.0
  • npm version: 8.12.1

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.

P粉469090753
P粉469090753

reply all(2)
P粉287345251

I also encountered the same error (Windows 10). Mine is very simple.

ERROR  Error: Failed to download template from registry: fetch failed

Yes, this has to do with the network or IP being blocked. I managed it though. This is what I do.

First enterC:\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).

// Some other ip address
185.199.108.133 raw.githubusercontent.com

This should do the trick.

P粉633075725

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!