--- title: "nuxt module" description: "Search, add, remove, and build Nuxt modules from the command line." links: - label: Source icon: i-simple-icons-github to: https://github.com/nuxt/cli/tree/main/packages/nuxt-cli/src/commands/module size: xs --- Nuxt provides a few utilities to work with [Nuxt modules](/modules) seamlessly. ## `nuxt module add` ```bash [Terminal] npx nuxt module add [--cwd=] [--logLevel=] [--skipInstall] [--skipConfig] [--dev] [--packageManager=] ``` ### Arguments | Argument | Description | |-----------------|---------------------------------------------------------------------| | `MODULENAME...` | Specify one or more modules to install by name, separated by spaces | ### Options | Option | Default | Description | |-----------------------------------------------------------------|---------|-------------------------------------------------| | `--cwd=` | `.` | Specify the root directory of your Nuxt project | | `--logLevel=` | | Specify build-time log level | | `--skipInstall` | | Skip npm install | | `--skipConfig` | | Skip nuxt.config.ts update | | `--dev` | | Install modules as dev dependencies | | `--packageManager=` | | Package manager to install with | The command lets you install [Nuxt modules](/modules) in your application with no manual work. When running the command, it will: - install the module as a dependency using your package manager - add it to your [package.json](/docs/directory-structure/package) file - update your [`nuxt.config`](/docs/directory-structure/nuxt-config) file **Example:** Installing the [`Pinia`](/modules/pinia) module ```bash [Terminal] npx nuxt module add pinia ``` Run it without a module name to pick from the modules compatible with your Nuxt version. ::note [`nuxt add`](/docs/api/commands/add) is the same command, and also accepts layers. :: ## `nuxt module remove` ```bash [Terminal] npx nuxt module remove [MODULENAME...] [--cwd=] [--logLevel=] [--skipInstall] [--skipConfig] ``` ### Arguments | Argument | Description | |-----------------|--------------------------------------------------------------------| | `MODULENAME...` | Specify one or more modules to remove by name, separated by spaces | ### Options | Option | Default | Description | |--------------------------------------|---------|-------------------------------------------------| | `--cwd=` | `.` | Specify the root directory of your Nuxt project | | `--logLevel=` | | Specify build-time log level | | `--skipInstall` | | Skip dependency uninstall | | `--skipConfig` | | Skip nuxt.config.ts update | The command uninstalls the package and removes it from the `modules` array in your [`nuxt.config`](/docs/directory-structure/nuxt-config). **Example:** ```bash [Terminal] npx nuxt module remove pinia ``` Run it without a module name to pick from the modules the project currently uses. ## `nuxt module search` ```bash [Terminal] npx nuxt module search [--cwd=] [--nuxtVersion=<3|4|4.2.0>] [--json] ``` ![nuxt module search](/capture/output/nuxt-module-search.svg) ### Arguments | Argument | Description | |----------|------------------------| | `QUERY` | keywords to search for | ### Options | Option | Default | Description | |-------------------------------|---------|------------------------------------------------------------------------------------| | `--cwd=` | `.` | Specify the root directory of your Nuxt project | | `--nuxtVersion=<3\|4\|4.2.0>` | | Filter by Nuxt version and list compatible modules only (auto detected by default) | | `--json` | | Print output as JSON | The command searches for Nuxt modules matching your query that are compatible with your Nuxt version, showing each module's description with the matched text highlighted. **Example:** ```bash [Terminal] npx nuxt module search pinia ``` Use `--json` to get the results as machine-readable JSON. ## `nuxt module build` ```bash [Terminal] npx nuxt module build [ROOTDIR] [--cwd=] [--outDir=] [--sourcemap] ``` ### Arguments | Argument | Description | |-----------|-----------------------------------------------------| | `ROOTDIR` | The root directory of your Nuxt module (default: .) | ### Options | Option | Default | Description | |------------------------|---------|-----------------------------------------------------------------| | `--cwd=` | | Specify the root directory of your Nuxt module | | `--outDir=` | | Output directory, relative to the module root (default: `dist`) | | `--sourcemap` | | Emit source maps | The command builds your module for publishing by running `nuxt-module-build build` from `@nuxt/module-builder` with all arguments passed through. `@nuxt/module-builder` must be installed in your module. **Example:** ```bash [Terminal] npx nuxt module build ``` ::read-more{to="https://github.com/nuxt/module-builder/blob/main/docs/2.commands.md#build" icon="i-simple-icons-github" target="\_blank"} Read more about `nuxt-module-build build`. :: ## `nuxt module prepare` ```bash [Terminal] npx nuxt module prepare [ROOTDIR] [--cwd=] ``` ### Arguments | Argument | Description | |-----------|-----------------------------------------------------| | `ROOTDIR` | The root directory of your Nuxt module (default: .) | ### Options | Option | Default | Description | |---------------------|---------|------------------------------------------------| | `--cwd=` | | Specify the root directory of your Nuxt module | The command creates the `.nuxt` directory and generates types for your module by running `nuxt-module-build prepare` from `@nuxt/module-builder` with all arguments passed through. **Example:** ```bash [Terminal] npx nuxt module prepare ``` ::read-more{to="https://github.com/nuxt/module-builder/blob/main/docs/2.commands.md#prepare" icon="i-simple-icons-github" target="\_blank"} Read more about `nuxt-module-build prepare`. ::