安装
使用我们的在线入门指南快速开始使用 Nuxt,或使用你的终端本地开始使用。
在线游戏
¥Play Online
如果你只想在浏览器中使用 Nuxt 而不设置项目,则可以使用我们的在线沙盒之一:
¥If you just want to play around with Nuxt in your browser without setting up a project, you can use one of our online sandboxes:
或者,按照以下步骤在你的计算机上设置一个新的 Nuxt 项目。
¥Or follow the steps below to set up a new Nuxt project on your computer.
新项目
¥New Project
先决条件
¥Prerequisites
- Node.js -
18.x
或更新版本(但我们推荐 当前 LTS 版本 模块) - 文本编辑器 - 没有 IDE 要求,但我们建议将 Visual Studio Code 与 官方 Vue 扩展(以前称为 Volar)或 WebStorm 一起使用,后者与 其他 JetBrains IDE 一起提供开箱即用的出色 Nuxt 支持。
- 终端 - 为了运行 Nuxt 命令
::details 最佳设置附加说明: - Node.js:确保使用偶数版本(18、20 等) - Nuxtr:安装社区开发的 Nuxtr extension - WSL:如果你使用的是 Windows 系统并且 HMR 运行缓慢,建议你尝试使用 WSL (Windows Subsystem for Linux),这可能会解决一些性能问题。::
::打开终端(如果你使用的是 Visual Studio Code,则可以打开 集成终端),并使用以下命令创建一个新的启动项目:¥Open a terminal (if you're using Visual Studio Code, you can open an integrated terminal) and use the following command to create a new starter project:或者,从你的终端切换到你的新项目目录:¥Or change directory into your new project from your terminal:
npm create nuxt <project-name>
yarn create nuxt <project-name>
pnpm create nuxt <project-name>
bun create nuxt <project-name>
或者,你可以打开 nuxt.new 并按照那里的说明找到其他启动器或主题。
在 Visual Studio Code 中打开项目文件夹:¥Open your project folder in Visual Studio Code:Terminal
code <project-name>
cd <project-name>
开发服务器
¥Development Server现在,你将能够以开发模式启动你的 Nuxt 应用:¥Now you'll be able to start your Nuxt app in development mode:npm run dev -- -o
yarn dev --open
pnpm dev -o
bun run dev -o
# To use the Bun runtime during development
# bun --bun run dev -o
做得好!浏览器窗口应自动为 http://localhost:3000 打开。¥Well done! A browser window should automatically open for http://localhost:3000.