Linux command
next 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create a new Next.js app
npx create-next-app@latest [app-name]
Start development server
next dev
Build for production
next build
Start production server
next start
Run linter
next lint
Print environment info
next info
Enable or disable telemetry
next telemetry --disable
说明
next is the Next.js CLI for developing, building, and serving React applications. It provides file-based routing, server-side rendering, static generation, and API routes out of the box. Running next with no command is an alias for next dev. Configuration lives in next.config.js (or .mjs/.ts). Starting with Next 13 the default output directory is .next.
参数
- dev _directory_
- Start development server with Hot Module Reloading.
- build _directory_
- Create an optimized production build.
- start _directory_
- Start the production server (requires build first).
- lint
- Run ESLint on the project.
- info
- Print system, binary, and package versions (for bug reports).
- telemetry --enable | --disable
- Enable or disable anonymous telemetry.
- -p, --port _port_
- Port to listen on (default: 3000). Applies to dev and start.
- -H, --hostname _host_
- Hostname to bind to (default: 0.0.0.0).
- --turbopack
- Force enable Turbopack (default in recent versions).
- --webpack
- Use Webpack instead of Turbopack.
- --experimental-https
- Serve dev over HTTPS using a self-signed certificate.
- -h, --help
- Display help information.
- -v, --version
- Display Next.js version.
FAQ
What is the next command used for?
next is the Next.js CLI for developing, building, and serving React applications. It provides file-based routing, server-side rendering, static generation, and API routes out of the box. Running next with no command is an alias for next dev. Configuration lives in next.config.js (or .mjs/.ts). Starting with Next 13 the default output directory is .next.
How do I run a basic next example?
Run `npx create-next-app@latest [app-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does dev _directory_ do in next?
Start development server with Hot Module Reloading.