Nuxt/docs/content/3.docs/1.usage/8.cli.md

3.6 KiB

Nuxi CLI

Nuxi is the new Command-line interface (CLI) for Nuxt 3. This page references the commands and options of Nuxi.

Init

npx nuxi init|create [--verbose|-v] [--template,-t] [dir]

The init command initializes a fresh Nuxt project.

Option Default Description
--verbose, -v false Log informations about the installation process.
--template, -t nuxt/starter#v3 Specify a Git repository to use as a template.
dir nuxt-app Name of the install directory.

Dev

npx nuxi dev [rootDir] [--clipboard] [--open, -o] [--port, -p] [--host, -h] [--https] [--ssl-cert] [--ssl-key]

The dev command starts a development server with hot module replacement at http://localhost:3000

Option Default Description
rootDir . The root directory of the application to serve.
--clipboard false Copy URL to clipboard.
--open, -o false Open URL in browser.
--port, -p 3000 Port to listen.
--host, -h localhost Hostname of the server.
--https false Listen with https protocol with a self-signed certificate by default.
--ssl-cert null Specify a certificate for https.
--ssl-key null Specify the key for the https certificate.

This command sets process.env.NODE_ENV to development. To override, define NODE_ENV in a .env file or as command-line argument.

Build

npx nuxi build [rootDir]

The build command creates a .output directory with all your application, server and dependencies ready for production.

Option Default Description
rootDir . The root directory of the application to bundle.

This command sets process.env.NODE_ENV to production. To override, define NODE_ENV in a .env file or as command-line argument.

Preview

npx nuxi preview [rootDir]

The preview command starts a server to preview your Nuxt application after running the build command.

Option Default Description
rootDir . The root directory of the application to preview.

This command sets process.env.NODE_ENV to production. To override, define NODE_ENV in a .env file or as command-line argument.

Info

npx nuxi info [rootDir]

The info command logs informations about the current or specified Nuxt project.

Option Default Description
rootDir . The directory of the target application.

Typecheck

npx nuxi typecheck [rootDir]

The typecheck command runs vue-tsc to check types throughout your app.

Option Default Description
rootDir . The directory of the target application.

This command sets process.env.NODE_ENV to production. To override, define NODE_ENV in a .env file or as command-line argument.

Upgrade

npx nuxi upgrade [--force|-f]

The upgrade command upgrades Nuxt 3 to the latest version.

Option Default Description
--force, -f false Removes node_modules and lock files before upgrade.