|
| 1 | +--- |
| 2 | +title: 'nuxt dev' |
| 3 | +description: The dev command starts a development server with hot module replacement at http://localhost:3000 |
| 4 | +links: |
| 5 | + - label: Source |
| 6 | + icon: i-simple-icons-github |
| 7 | + to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/dev.ts |
| 8 | + size: xs |
| 9 | +--- |
| 10 | + |
| 11 | +<!--dev-cmd--> |
| 12 | +```bash [Terminal] |
| 13 | +npx nuxt dev [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--envName] [-e, --extends=<layer-name>] [--clear] [--no-f, --no-fork] [-p, --port] [-h, --host] [--clipboard] [-o, --open] [--https] [--publicURL] [--qr] [--public] [--tunnel] [--profile[=verbose]] [--sslCert] [--sslKey] |
| 14 | +``` |
| 15 | +<!--/dev-cmd--> |
| 16 | +
|
| 17 | +The `dev` command starts a development server with hot module replacement at [http://localhost:3000](https://localhost:3000) |
| 18 | +
|
| 19 | +## Arguments |
| 20 | +
|
| 21 | +<!--dev-args--> |
| 22 | +| Argument | Description | |
| 23 | +|---------------|------------------------------------------------| |
| 24 | +| `ROOTDIR="."` | Specifies the working directory (default: `.`) | |
| 25 | +<!--/dev-args--> |
| 26 | +
|
| 27 | +## Options |
| 28 | +
|
| 29 | +<!--dev-opts--> |
| 30 | +| Option | Default | Description | |
| 31 | +|--------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 32 | +| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) | |
| 33 | +| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level | |
| 34 | +| `--dotenv` | | Path to `.env` file to load, relative to the root directory | |
| 35 | +| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) | |
| 36 | +| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer | |
| 37 | +| `--clear` | `false` | Clear console on restart | |
| 38 | +| `--no-f, --no-fork` | | Disable forked mode | |
| 39 | +| `-p, --port` | | Port to listen on (default: `NUXT_PORT \|\| NITRO_PORT \|\| PORT \|\| nuxtOptions.devServer.port`) | |
| 40 | +| `-h, --host` | | Host to listen on (default: `NUXT_HOST \|\| NITRO_HOST \|\| HOST \|\| nuxtOptions.devServer?.host`) | |
| 41 | +| `--clipboard` | `false` | Copy the URL to the clipboard | |
| 42 | +| `-o, --open` | `false` | Open the URL in the browser | |
| 43 | +| `--https` | | Enable HTTPS | |
| 44 | +| `--publicURL` | | Displayed public URL (used for QR code) | |
| 45 | +| `--qr` | | Display The QR code of public URL when available | |
| 46 | +| `--public` | | Listen to all network interfaces | |
| 47 | +| `--tunnel` | | Open a tunnel using https://github.com/unjs/untun | |
| 48 | +| `--profile` :badge[v4.4]{color="info" size="xs" class="align-middle"} | | Profile performance. Writes a V8 CPU profile and JSON report on exit. Use `--profile=verbose` for a full console report. | |
| 49 | +| `--sslCert` | | (DEPRECATED) Use `--https.cert` instead. | |
| 50 | +| `--sslKey` | | (DEPRECATED) Use `--https.key` instead. | |
| 51 | +<!--/dev-opts--> |
| 52 | +
|
| 53 | +The port and host can also be set via NUXT_PORT, PORT, NUXT_HOST or HOST environment variables. |
| 54 | +
|
| 55 | +Additionally to the above options, `@nuxt/cli` can pass options through to `listhen`, e.g. `--no-qr` to turn off the dev server QR code. You can find the list of `listhen` options in the [unjs/listhen](https://github.com/unjs/listhen) docs. |
| 56 | +
|
| 57 | +This command sets `process.env.NODE_ENV` to `development`. |
| 58 | +
|
| 59 | +::note |
| 60 | +If you are using a self-signed certificate in development, you will need to set `NODE_TLS_REJECT_UNAUTHORIZED=0` in your environment. |
| 61 | +:: |
0 commit comments