C:\Users\Admin\Desktop>npx nuxi init nuxt-app
Need to install the following packages:
nuxi@3.3.2
Ok to proceed? (y) y
Nuxi 3.3.2
ERROR Error: Failed to download template from registry: request to https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json failed, reason: getaddrinfo ENOENT raw.githubusercontent.com
使用 pnpm
C:\Users\Admin\Desktop>pnpm dlx nuxi init nuxt-app
.../Local/pnpm/store/v3/tmp/dlx-35884 | +1 +
.../Local/pnpm/store/v3/tmp/dlx-35884 | Progress: resolved 2, reused 1, downloaded 0, added 0.../Local/pnpm/store/v3/tmp/dlx-35884 | Progress: resolved 2, reused 1, downloaded 0, added 1, done17:16:44
ERROR Error: Failed to download template from registry: request to https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json failed, reason: getaddrinfo ENOENT raw.githubusercontent.com
ERROR Command failed with exit code 1: nuxi init nuxt-app
pnpm: Command failed with exit code 1: nuxi init nuxt-app
at makeError (C:\Users\Admin\AppData\Roaming\nvm\v16.18.0\node_modules\pnpm\dist\pnpm.cjs:23105:17)
at handlePromise (C:\Users\Admin\AppData\Roaming\nvm\v16.18.0\node_modules\pnpm\dist\pnpm.cjs:23676:33)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.handler [as dlx](C:\Users\Admin\AppData\Roaming\nvm\v16.18.0\node_modules\pnpm\dist\pnpm.cjs:217551:7)
at async C:\Users\Admin\AppData\Roaming\nvm\v16.18.0\node_modules\pnpm\dist\pnpm.cjs:225158:21
at async main (C:\Users\Admin\AppData\Roaming\nvm\v16.18.0\node_modules\pnpm\dist\pnpm.cjs:225127:34)
at async runPnpm (C:\Users\Admin\AppData\Roaming\nvm\v16.18.0\node_modules\pnpm\dist\pnpm.cjs:225357:5)
at async C:\Users\Admin\AppData\Roaming\nvm\v16.18.0\node_modules\pnpm\dist\pnpm.cjs:225349:7
解决方案
设置 DNS 为 114.114.114.114
重新执行 Nuxt 初始化
C:\Users\Admin\Desktop>npx nuxi init nuxt-app
Nuxi 3.3.2 17:27:15
✨ Nuxt project is created with v3 template. Next steps: 17:27:16
› cd nuxt-app 17:27:16
› Install dependencies with npminstall or yarninstall or pnpminstall17:27:16
› Start development server with npm run dev or yarn dev or pnpm run dev
C:\Users\Admin\Desktop>pnpm dlx nuxi init nuxt-app
.../Local/pnpm/store/v3/tmp/dlx-33336 | +1 +
.../Local/pnpm/store/v3/tmp/dlx-33336 | Progress: resolved 2, reused 1, downloaded 0, added 0.../Local/pnpm/store/v3/tmp/dlx-33336 | Progress: resolved 2, reused 1, downloaded 0, added 1, done17:27:32
✨ Nuxt project is created with v3 template. Next steps: 17:27:36
› cd nuxt-app 17:27:36
› Install dependencies with npminstall or yarninstall or pnpminstall17:27:36
› Start development server with npm run dev or yarn dev or pnpm run dev 17:27:36