Nuxt 3 reached end of life on 31 July 2026
It no longer receives bug fixes or security patches. Upgrade to Nuxt 4 or get extended support from HeroDevs
创建 Nuxt
init 命令初始化一个全新的 Nuxt 项目
Terminal
npm create nuxt@latest [DIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [-t, --template] [-f, --force] [--offline] [--preferOffline] [--no-install] [--gitInit] [--shell] [--packageManager] [-M, --modules] [--no-modules] [--nightly]
create-nuxt 命令使用 unjs/giget 初始化一个全新的 Nuxt 项目。
参数
| 参数 | 描述 |
|---|---|
DIR="" | 项目目录 |
选项
| 选项 | 默认值 | 描述 |
|---|---|---|
--cwd=<directory> | . | 指定工作目录 |
--logLevel=<silent|info|verbose> | 指定构建时日志级别 | |
-t, --template | 模板名称 | |
-f, --force | 覆盖现有目录 | |
--offline | 强制使用离线模式 | |
--preferOffline | 优先使用离线模式 | |
--no-install | 跳过安装依赖 | |
--gitInit | 初始化 git 仓库 | |
--shell | 在项目目录中安装完成后启动 shell | |
--packageManager | 包管理器选择(npm、pnpm、yarn、bun) | |
-M, --modules | 要安装的 Nuxt 模块(以逗号分隔且不含空格) | |
--no-modules | 跳过模块安装提示 | |
--nightly | 使用 Nuxt nightly 发布渠道(3x 或 latest) |
环境变量
NUXI_INIT_REGISTRY:设置自定义模板注册表。(了解更多)。- 默认注册表加载自 nuxt/starter/templates