2020-01-03 19:16:51 +01:00
---
description: The Next.js CLI allows you to start, build, and export your application. Learn more about it here.
---
2019-12-23 16:07:38 +01:00
# Next.js CLI
The Next.js CLI allows you to start, build, and export your application.
To get a list of the available CLI commands, run the following command inside your project directory:
```bash
npx next -h
```
_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher)_
The output should look like this:
```bash
Usage
$ next < command >
Available commands
build, start, export, dev, telemetry
Options
--version, -v Version number
--help, -h Displays this message
For more information run a command with the --help flag
$ next build --help
```
2020-03-04 11:53:20 +01:00
You can pass any [node arguments ](https://nodejs.org/api/cli.html#cli_node_options_options ) to `next` commands:
2019-12-23 16:07:38 +01:00
```bash
2020-03-04 11:53:20 +01:00
NODE_OPTIONS='--throw-deprecation' next
NODE_OPTIONS='-r esm' next
NODE_OPTIONS='--inspect' next
2019-12-23 16:07:38 +01:00
```
2020-04-20 11:17:12 +02:00
## Build
`next build` creates an optimized production build of your application. The output displays information about each route.
- **Size** – The number of assets downloaded when navigating to the page client-side. The size for each route only includes its dependencies.
- **First Load JS** – The number of assets downloaded when visiting the page from the server. The amount of JS shared by all is shown as a separate metric.
The first load is colored green, yellow, or red. Aim for green for performant applications.
2020-04-24 23:29:26 +02:00
2020-05-02 06:05:26 +02:00
## Development
`next dev` starts the application in development mode with hot-code reloading, error reporting, and more:
The application will start at `http://localhost:3000` by default. The default port can be changed with `-p` , like so:
```bash
npx next dev -p 4000
```
## Production
`next start` starts the application in production mode. The application should be compiled with [`next build` ](#build ) first.
The application will start at `http://localhost:3000` by default. The default port can be changed with `-p` , like so:
```bash
npx next start -p 4000
```
2020-04-24 23:29:26 +02:00
## Telemetry
Next.js collects **completely anonymous** telemetry data about general usage.
Participation in this anonymous program is optional, and you may opt-out if you'd not like to share any information.
To learn more about Telemetry, [please read this document ](https://nextjs.org/telemetry/ ).