Nuxt3开发笔记

nuxi init报错

Preview

有时候当我们创建nuxt项目会遇到下面的报错

$  npx nuxi init demo
Nuxi 3.0.0-rc.14                                                                                                                                                                                                                             21:55:35

 ERROR  Failed to download template from registry: request to https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json failed, reason: connect ECONNREFUSED 0.0.0.0:443                                                    21:55:35

  at /Applications/MxSrvs/cache/nodejs/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:15133:11
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async downloadTemplate (/Applications/MxSrvs/cache/nodejs/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:15132:20)
  at async Object.invoke (/Applications/MxSrvs/cache/nodejs/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:15200:15)
  at async _main (/Applications/MxSrvs/cache/nodejs/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/cli.mjs:50:20)

这个错误通常只有中国的用户才会遇到,我们可以通过修改电脑的网络设置即可解决

修改网络DNS服务器为 114.114.114.114