Nuxt CLI

Source
The Nuxt CLI runs, builds and inspects your Nuxt application from the command line.

@nuxt/cli is the nuxt command: it runs the dev server, builds your application for production, scaffolds files, manages modules and answers questions about your project. It is a dependency of nuxt, so a Nuxt project already has it.

Terminal
npx nuxt dev

The binary is installed as nuxt, and also as nuxi, nuxi-ng and nuxt-cli for compatibility with older setups.

Two other packages ship the same commands for different situations. nuxi is a standalone build with no runtime dependencies, for running commands outside a project or installing globally. Scaffolding a new project is create-nuxt, a separate package so that it can be run without a project to install into.

Running commands

Inside a project, your package manager runs the version the project depends on:

Terminal
pnpm nuxt dev
npm exec nuxt dev
yarn nuxt dev
bun nuxt dev

Outside a project, npx nuxi runs the same commands from its own bundled copy.

Global options

--cwd may be passed before the command name as well as after it, which is useful in a monorepo:

Terminal
npx nuxt --cwd apps/web dev

Commands that take a ROOTDIR positional treat an explicit --cwd as an override of it. --help on any command prints its arguments and options, and --version prints the CLI version.

Node.js 18 or newer is required. Older versions still run, with a warning that they are unsupported.

Project commands

A command the CLI does not provide is looked up as a nuxt-<command> binary in your project, so a dependency can add a command of its own. This is how nuxt build-module works: it runs the nuxt-build-module binary that @nuxt/module-builder installs.

Shell completions

nuxt complete <shell> prints a completion script, powered by @bomb.sh/tab. It completes commands, flags and some flag values: ports and hosts for nuxt dev, Nitro presets for nuxt build --preset, starter templates for nuxt init --template, and log levels.

npx nuxt complete zsh > "${fpath[1]}/_nuxt"

powershell is also supported, and create-nuxt complete <shell> has its own script which completes starter template names.

Completions work through your package manager too (pnpm nuxt <Tab>), if you install tab's package manager completions.

Debugging the CLI

Set DEBUG=nuxi for extra diagnostics from the CLI itself, such as dev server startup timings and the paths it removes during cleanup.

Prereleases

Every commit is published to the nightly channel:

Terminal
npm install -D @nuxt/cli-nightly
npx @nuxt/cli-nightly dev

create-nuxt-nightly scaffolds with it, and npm create nuxt@latest --nightly scaffolds a project against the Nuxt nightly channel.

Builds for an individual pull request are published by pkg.pr.new and linked from the pull request itself, which is the quickest way to check whether a fix works before it is released.