Skip to content

The Nx command line has various subcommands and options to help you manage your Nx workspace and run tasks efficiently. Below is a complete reference for all available commands and their options. You can run nx —help to view all available options.

Install a plugin and initialize it.

Usage:

Terminal window
nx add <packageSpecifier>

Install the @nx/react package matching the installed version of the nx package and run its @nx/react:init generator:

Terminal window
nx add @nx/react

Install the latest version of the non-core-nx-plugin package and run its non-core-nx-plugin:init generator if available:

Terminal window
nx add non-core-nx-plugin

Install version 17.0.0 of the @nx/react package and run its @nx/react:init generator:

Terminal window
nx add @nx/react@17.0.0
OptionTypeDescriptionDefault
--helpbooleanShow help
--packageSpecifierstringThe package name and optional version (e.g. @nx/react or @nx/react@latest) to install and initialize. If the version is not specified it will install the same version as the nx package for Nx core plugins or the latest version for other packages.
--updatePackageScriptsbooleanUpdate package.json scripts with inferred targets. Defaults to true when the package is a core Nx plugin.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Run target for affected projects. Affected projects are projects that have been changed and projects that depend on the changed projects. See https://nx.dev/ci/features/affected for more details.

Usage:

Terminal window
nx affected

Run custom target for all affected projects:

Terminal window
nx affected -t custom-target

Run tests in parallel:

Terminal window
nx affected -t test --parallel=5

Run lint, test, and build targets for affected projects. Requires Nx v15.4+:

Terminal window
nx affected -t lint test build

Run tests for all the projects affected by changing the index.ts file:

Terminal window
nx affected -t test --files=libs/mylib/src/index.ts

Run tests for all the projects affected by the changes between main and HEAD (e.g., PR):

Terminal window
nx affected -t test --base=main --head=HEAD

Run tests for all the projects affected by the last commit on main:

Terminal window
nx affected -t test --base=main~1 --head=main

Run build for only projects with the tag dotnet:

Terminal window
nx affected -t=build --exclude='*,!tag:dotnet'

Use the currently executing project name in your command:

Terminal window
nx affected -t build --tag=$NX_TASK_TARGET_PROJECT:latest

Preview the task graph that Nx would run inside a webview:

Terminal window
nx affected -t=build --graph

Save the task graph to a file:

Terminal window
nx affected -t=build --graph=output.json

Print the task graph to the console:

Terminal window
nx affected -t=build --graph=stdout
OptionTypeDescriptionDefault
--allboolean⚠️ Deprecated: Use nx run-many instead
--basestringBase of the current branch (usually main).
--batchbooleanRun task(s) in batches for executors which support batches.false
--configuration, -cstringThis is the configuration to use when performing tasks on projects.
--excludestringExclude certain projects from being processed.
--excludeTaskDependenciesbooleanSkips running dependent tasks first.false
--filesstringChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--graphstringShow the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser. Pass “stdout” to print the results to the terminal.
--helpbooleanShow help
--nxBailbooleanStop command execution after the first failed task.false
--nxIgnoreCyclesbooleanIgnore cycles in the task graph.false
--outputStylestringDefines how Nx emits outputs tasks logs. tui: enables the Nx Terminal UI, recommended for local development environments. dynamic-legacy: use dynamic-legacy output life cycle, previous content is overwritten or modified as new outputs are added, display minimal logs by default, always show errors. This output format is recommended for local development environments where tui is not supported. static: uses static output life cycle, no previous content is rewritten or modified as new outputs are added. This output format is recommened for CI environments. stream: nx by default logs output to an internal output stream, enable this option to stream logs to stdout / stderr. stream-without-prefixes: nx prefixes the project name the target is running on, use this option remove the project name prefix from output. (choices: dynamic-legacy, dynamic, tui, static, stream, stream-without-prefixes)
--parallelstringMax number of parallel processes [default is 3].
--runnerstringThis is the name of the tasks runner configured in nx.json.
--skipNxCache, --disableNxCachebooleanRerun the tasks even when the results are available in the cache.false
--skipRemoteCache, --disableRemoteCachebooleanDisables the remote cache.false
--skipSyncbooleanSkips running the sync generators associated with the tasks.false
--targets, --target, -tstringTasks to run for affected projects.
--tuibooleanEnable or disable the Nx Terminal UI.
--tuiAutoExitstringWhether or not to exit the TUI automatically after all tasks finish, and after how long. If set to true, the TUI will exit immediately. If set to false the TUI will not automatically exit. If set to a number, an interruptible countdown popup will be shown for that many seconds before the TUI exits.
--uncommittedbooleanUncommitted changes.
--untrackedbooleanUntracked changes.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Configure and update AI agent configurations for your workspace.

Usage:

Terminal window
nx configure-ai-agents
OptionTypeDescriptionDefault
--agentsstringList of AI agents to set up. (choices: claude, codex, copilot, cursor, gemini, opencode)
--checkstringCheck agent configurations. Use —check or —check=outdated to check only configured agents, or —check=all to include unconfigured/partial configurations. Does not make any changes. (choices: outdated, all)
--helpbooleanShow help
--interactivebooleanWhen false disables interactive input prompts for options.true
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Connect workspace to Nx Cloud.

Usage:

Terminal window
nx connect
OptionTypeDescriptionDefault
--generateTokenbooleanExplicitly asks for a token to be created, do not override existing tokens from Nx Cloud.
--helpbooleanShow help
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Prints information about the Nx Daemon process or starts a daemon process.

Usage:

Terminal window
nx daemon
OptionTypeDescriptionDefault
--helpbooleanShow help
--startbooleanNo Descriptionfalse
--stopbooleanNo Descriptionfalse
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Download the Nx Cloud client.

Usage:

Terminal window
nx download-cloud-client
OptionTypeDescriptionDefault
--helpbooleanShow help
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Fixes CI failures. This command is an alias for nx-cloud fix-ci.

Usage:

Terminal window
nx fix-ci [options]
OptionTypeDescriptionDefault
--helpbooleanShow help.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Check for un-formatted files.

Usage:

Terminal window
nx format:check
OptionTypeDescriptionDefault
--allbooleanFormat all projects.
--basestringBase of the current branch (usually main).
--excludestringExclude certain projects from being processed.
--filesstringChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--helpbooleanShow help
--libs-and-appsbooleanFormat only libraries and applications files.
--projectsstringProjects to format (comma/space delimited).
--sort-root-tsconfig-pathsbooleanEnsure the workspace’s tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. The default value is “false” unless NX_FORMAT_SORT_TSCONFIG_PATHS is set to “true”.
--uncommittedbooleanUncommitted changes.
--untrackedbooleanUntracked changes.
--versionbooleanShow version number

Overwrite un-formatted files.

Usage:

Terminal window
nx format:write
OptionTypeDescriptionDefault
--allbooleanFormat all projects.
--basestringBase of the current branch (usually main).
--excludestringExclude certain projects from being processed.
--filesstringChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--helpbooleanShow help
--libs-and-appsbooleanFormat only libraries and applications files.
--projectsstringProjects to format (comma/space delimited).
--sort-root-tsconfig-pathsbooleanEnsure the workspace’s tsconfig compilerOptions.paths are sorted. Warning: This will cause comments in the tsconfig to be lost. The default value is “false” unless NX_FORMAT_SORT_TSCONFIG_PATHS is set to “true”.
--uncommittedbooleanUncommitted changes.
--untrackedbooleanUntracked changes.
--versionbooleanShow version number

Graph dependencies within workspace.

Usage:

Terminal window
nx graph

Open the project graph of the workspace in the browser:

Terminal window
nx graph

Save the project graph into a json file:

Terminal window
nx graph --file=output.json

Generate a static website with project graph into an html file, accompanied by an asset folder called static:

Terminal window
nx graph --file=output.html

Print the project graph as JSON to the console:

Terminal window
nx graph --print

Show the graph where every node is either an ancestor or a descendant of todos-feature-main:

Terminal window
nx graph --focus=todos-feature-main

Exclude project-one and project-two from the project graph:

Terminal window
nx graph --exclude=project-one,project-two

Show the graph where every node is either an ancestor or a descendant of todos-feature-main, but exclude project-one and project-two:

Terminal window
nx graph --focus=todos-feature-main --exclude=project-one,project-two

Watch for changes to project graph and update in-browser:

Terminal window
nx graph --watch
OptionTypeDescriptionDefault
--affectedbooleanHighlight affected projects.
--basestringBase of the current branch (usually main).
--excludestringExclude certain projects from being processed.
--filestringOutput file (e.g. —file=output.json or —file=dep-graph.html).
--filesstringChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--focusstringUse to show the project graph for a particular project and every node that is either an ancestor or a descendant.
--groupByFolderbooleanGroup projects by folder in the project graph.
--helpbooleanShow help
--hoststringBind the project graph server to a specific ip address.
--openbooleanOpen the project graph in the browser.true
--portnumberBind the project graph server to a specific port.
--printbooleanPrint the project graph to stdout in the terminal.
--targetsstringThe target to show tasks for in the task graph.
--uncommittedbooleanUncommitted changes.
--untrackedbooleanUntracked changes.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number
--viewstringChoose whether to view the projects or task graph. (choices: projects, tasks)projects
--watchbooleanWatch for changes to project graph and update in-browser.true

Import code and git history from another repository into this repository.

Usage:

Terminal window
nx import [sourceRepository] [destinationDirectory]
OptionTypeDescriptionDefault
--depthnumberThe depth to clone the source repository (limit this for faster git clone).
--destinationDirectory, --destinationstringThe directory in the current workspace to import into.
--helpbooleanShow help
--interactivebooleanInteractive mode.true
--refstringThe branch from the source repository to import.
--sourceDirectory, --sourcestringThe directory in the source repository to import from.
--sourceRepositorystringThe remote URL of the source to import.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.

Usage:

Terminal window
nx init
OptionTypeDescriptionDefault
--aiAgentsstringList of AI agents to set up. (choices: claude, codex, copilot, cursor, gemini, opencode)
--forcebooleanForce the migration to continue and ignore custom webpack setup or uncommitted changes. Only for CRA projects.false
--helpbooleanShow help
--interactivebooleanWhen false disables interactive input prompts for options.true
--nxCloudbooleanSet up distributed caching with Nx Cloud.
--useDotNxInstallationbooleanInitialize an Nx workspace setup in the .nx directory of the current repository.false
--versionbooleanShow version number

Lists installed plugins, capabilities of installed plugins and other available plugins.

Usage:

Terminal window
nx list [plugin]

List the plugins installed in the current workspace:

Terminal window
nx list

List the generators and executors available in the @nx/web plugin if it is installed (If the plugin is not installed nx will show advice on how to add it to your workspace):

Terminal window
nx list @nx/web
OptionTypeDescriptionDefault
--helpbooleanShow help
--pluginstringThe name of an installed plugin to query.
--versionbooleanShow version number

Login to Nx Cloud. This command is an alias for nx-cloud login.

Usage:

Terminal window
nx login [nxCloudUrl]
OptionTypeDescriptionDefault
--helpbooleanShow help.
--nxCloudUrlstringThe Nx Cloud URL of the instance you are trying to connect to. If no positional argument is provided, this command will connect to your configured Nx Cloud instance by default.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Logout from Nx Cloud. This command is an alias for nx-cloud logout.

Usage:

Terminal window
nx logout
OptionTypeDescriptionDefault
--helpbooleanShow help.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Starts the Nx MCP server.

Usage:

Terminal window
nx mcp

Creates a migrations file or runs migrations from the migrations file.

  • Migrate packages and create migrations.json (e.g., nx migrate @nx/workspace@latest)
  • Run migrations (e.g., nx migrate —run-migrations=migrations.json). Use flag —if-exists to run migrations only if the migrations file exists.

Usage:

Terminal window
nx migrate [packageAndVersion]

Update all Nx plugins to “latest”. This will generate migrations.json:

Terminal window
nx migrate latest

Update all Nx plugins to “9.0.0”. This will generate migrations.json:

Terminal window
nx migrate 9.0.0

Update @nx/workspace and generate the list of migrations starting with version 8.0.0 of @nx/workspace and @nx/node, regardless of what is installed locally:

Terminal window
nx migrate @nx/workspace@9.0.0 --from="@nx/workspace@8.0.0,@nx/node@8.0.0"

Update @nx/workspace to “9.0.0”. If it tries to update @nx/react or @nx/angular, use version “9.0.1”:

Terminal window
nx migrate @nx/workspace@9.0.0 --to="@nx/react@9.0.1,@nx/angular@9.0.1"

Update another-package to “12.0.0”. This will update other packages and will generate migrations.json file:

Terminal window
nx migrate another-package@12.0.0

Collect package updates and migrations in interactive mode. In this mode, the user will be prompted whether to apply any optional package update and migration:

Terminal window
nx migrate latest --interactive

Collect package updates and migrations starting with version 14.5.0 of “nx” (and Nx first-party plugins), regardless of what is installed locally, while excluding migrations that should have been applied on previous updates:

Terminal window
nx migrate latest --from=nx@14.5.0 --exclude-applied-migrations

Run migrations from the provided migrations.json file. You can modify migrations.json and run this command many times:

Terminal window
nx migrate --run-migrations=migrations.json

Create a dedicated commit for each successfully completed migration. You can customize the prefix used for each commit by additionally setting —commit-prefix=“PREFIX_HERE “:

Terminal window
nx migrate --run-migrations --create-commits
OptionTypeDescriptionDefault
--commitPrefixstringCommit prefix to apply to the commit for each migration, when —create-commits is enabled.chore: [nx migration]
--createCommits, -CbooleanAutomatically create a git commit after each migration runs.false
--excludeAppliedMigrationsbooleanExclude migrations that should have been applied on previous updates. To be used with —from.false
--fromstringUse the provided versions for packages instead of the ones installed in node_modules (e.g., —from=“@nx/react@16.0.0,@nx/js@16.0.0”).
--helpbooleanShow help
--ifExistsbooleanRun migrations only if the migrations file exists, if not continues successfully.false
--interactivebooleanEnable prompts to confirm whether to collect optional package updates and migrations.false
--packageAndVersionstringThe target package and version (e.g, @nx/workspace@16.0.0).
--runMigrationsstringExecute migrations from a file (when the file isn’t provided, execute migrations from migrations.json).
--tostringUse the provided versions for packages instead of the ones calculated by the migrator (e.g., —to=“@nx/react@16.0.0,@nx/js@16.0.0”).
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Records a command execution for distributed task execution. This command is an alias for nx-cloud record.

Usage:

Terminal window
nx record [options]
OptionTypeDescriptionDefault
--helpbooleanShow help.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Orchestrate versioning and publishing of applications and libraries.

Usage:

Terminal window
nx release
OptionTypeDescriptionDefault
--dry-run, -dbooleanPreview the changes without updating files/creating releases.false
--groups, --group, -gstringOne or more release groups to target with the current command.
--helpbooleanShow help
--printConfigstringPrint the resolved nx release configuration that would be used for the current command and then exit.
--projects, -pstringProjects to run. (comma/space delimited project names and/or patterns).
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Generate a changelog for one or more projects, and optionally push to Github.

Usage:

Terminal window
nx changelog [version]
OptionTypeDescriptionDefault
--first-releasebooleanIndicates that this is the first release for the selected release group. If the current version cannot be determined as usual, the version on disk will be used as a fallback. This is useful when using git or the registry to determine the current version of packages, since those sources are only available after the first release. Also indicates that changelog generation should not assume a previous git tag exists and that publishing should not check for the existence of the package before running.
--fromstringThe git reference to use as the start of the changelog. If not set it will attempt to resolve the latest tag and use that.
--git-commitbooleanWhether or not to automatically commit the changes made by this command.
--git-commit-argsstringAdditional arguments (added after the —message argument, which may or may not be customized with —git-commit-message) to pass to the git commit command invoked behind the scenes.
--git-commit-messagestringCustom git commit message to use when committing the changes made by this command. {version} will be dynamically interpolated when performing fixed releases, interpolated tags will be appended to the commit body when performing independent releases.
--git-pushbooleanWhether or not to automatically push the changes made by this command to the remote git repository.
--git-push-argsstringAdditional arguments to pass to the git push command invoked behind the scenes.
--git-remotestringAlternate git remote to push commits and tags to (can be useful for testing).origin
--git-tagbooleanWhether or not to automatically tag the changes made by this command.
--git-tag-argsstringAdditional arguments to pass to the git tag command invoked behind the scenes.
--git-tag-messagestringCustom git tag message to use when tagging the changes made by this command. This defaults to be the same value as the tag itself.
--helpbooleanShow help
--interactive, -istringInteractively modify changelog markdown contents in your code editor before applying the changes. You can set it to be interactive for all changelogs, or only the workspace level, or only the project level. (choices: all, workspace, projects)
--replace-existing-contentsbooleanWhether to overwrite the existing changelog contents instead of prepending to them.false
--resolve-version-plansstringHow to resolve version plans for changelog generation, defaults to resolving all version plan files available on disk. (choices: all, using-from-and-to)all
--stage-changesbooleanWhether or not to stage the changes made by this command. Always treated as true if git-commit is true.
--tostringThe git reference to use as the end of the changelog.HEAD
--versionstringThe version to create a Github release and changelog for.

Create a version plan file to specify the desired semver bump for one or more projects or groups, as well as the relevant changelog entry.

Usage:

Terminal window
nx plan [bump]
OptionTypeDescriptionDefault
--basestringBase of the current branch (usually main).
--bumpstringSemver keyword to use for the selected release group. (choices: major, premajor, minor, preminor, patch, prepatch, prerelease)
--excludestringExclude certain projects from being processed.
--filesstringChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--helpbooleanShow help
--message, -mstringCustom message to use for the changelog entry.
--onlyTouchedbooleanOnly include projects that have been affected by the current changes.true
--uncommittedbooleanUncommitted changes.
--untrackedbooleanUntracked changes.
--versionbooleanShow version number

Ensure that all touched projects have an applicable version plan created for them.

Usage:

Terminal window
nx plan:check
OptionTypeDescriptionDefault
--basestringBase of the current branch (usually main).
--excludestringExclude certain projects from being processed.
--filesstringChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--helpbooleanShow help
--uncommittedbooleanUncommitted changes.
--untrackedbooleanUntracked changes.
--versionbooleanShow version number

Publish a versioned project to a registry.

Usage:

Terminal window
nx publish
OptionTypeDescriptionDefault
--accessstringOverrides the access level of the published package. Unscoped packages cannot be set to restricted. See the npm publish documentation for more information. (choices: public, restricted)
--allboolean[deprecated] run-many runs all targets on all projects in the workspace if no projects are provided. This option is no longer required.true
--excludestringExclude certain projects from being processed.
--excludeTaskDependenciesbooleanSkips running dependent tasks first.false
--first-releasebooleanIndicates that this is the first release for the selected release group. If the current version cannot be determined as usual, the version on disk will be used as a fallback. This is useful when using git or the registry to determine the current version of packages, since those sources are only available after the first release. Also indicates that changelog generation should not assume a previous git tag exists and that publishing should not check for the existence of the package before running.
--graphstringShow the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser. Pass “stdout” to print the results to the terminal.
--helpbooleanShow help
--nxBailbooleanStop command execution after the first failed task.false
--nxIgnoreCyclesbooleanIgnore cycles in the task graph.false
--otpnumberA one-time password for publishing to a registry that requires 2FA.
--outputStylestringDefines how Nx emits outputs tasks logs. tui: enables the Nx Terminal UI, recommended for local development environments. dynamic-legacy: use dynamic-legacy output life cycle, previous content is overwritten or modified as new outputs are added, display minimal logs by default, always show errors. This output format is recommended for local development environments where tui is not supported. static: uses static output life cycle, no previous content is rewritten or modified as new outputs are added. This output format is recommened for CI environments. stream: nx by default logs output to an internal output stream, enable this option to stream logs to stdout / stderr. stream-without-prefixes: nx prefixes the project name the target is running on, use this option remove the project name prefix from output. (choices: dynamic-legacy, dynamic, tui, static, stream, stream-without-prefixes)
--parallelstringMax number of parallel processes [default is 3].
--projects, -pstringProjects to run. (comma/space delimited project names and/or patterns).
--registrystringThe registry to publish to.
--runnerstringThis is the name of the tasks runner configured in nx.json.
--skipNxCache, --disableNxCachebooleanRerun the tasks even when the results are available in the cache.false
--skipRemoteCache, --disableRemoteCachebooleanDisables the remote cache.false
--skipSyncbooleanSkips running the sync generators associated with the tasks.false
--tagstringThe distribution tag to apply to the published package.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Create a version and release for one or more applications and libraries.

Usage:

Terminal window
nx version [specifier]
OptionTypeDescriptionDefault
--dockerVersionstringExact docker version to use, bypassing the version scheme logic. Warning: Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.
--dockerVersionSchemestringExact docker version scheme to apply to the selected release group. Warning: Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.
--first-releasebooleanIndicates that this is the first release for the selected release group. If the current version cannot be determined as usual, the version on disk will be used as a fallback. This is useful when using git or the registry to determine the current version of packages, since those sources are only available after the first release. Also indicates that changelog generation should not assume a previous git tag exists and that publishing should not check for the existence of the package before running.
--git-commitbooleanWhether or not to automatically commit the changes made by this command.
--git-commit-argsstringAdditional arguments (added after the —message argument, which may or may not be customized with —git-commit-message) to pass to the git commit command invoked behind the scenes.
--git-commit-messagestringCustom git commit message to use when committing the changes made by this command. {version} will be dynamically interpolated when performing fixed releases, interpolated tags will be appended to the commit body when performing independent releases.
--git-pushbooleanWhether or not to automatically push the changes made by this command to the remote git repository.
--git-push-argsstringAdditional arguments to pass to the git push command invoked behind the scenes.
--git-remotestringAlternate git remote to push commits and tags to (can be useful for testing).origin
--git-tagbooleanWhether or not to automatically tag the changes made by this command.
--git-tag-argsstringAdditional arguments to pass to the git tag command invoked behind the scenes.
--git-tag-messagestringCustom git tag message to use when tagging the changes made by this command. This defaults to be the same value as the tag itself.
--helpbooleanShow help
--preidstringThe optional prerelease identifier to apply to the version. This will only be applied in the case that the specifier argument has been set to prerelease OR when conventional commits are enabled, in which case it will modify the resolved specifier from conventional commits to be its prerelease equivalent. E.g. minor -> preminor.
--specifierstringExact version or semver keyword to apply to the selected release group.
--stage-changesbooleanWhether or not to stage the changes made by this command. Always treated as true if git-commit is true.
--versionbooleanShow version number

Repair any configuration that is no longer supported by Nx.

Specifically, this will run every migration within the `nx` package
against the current repository. Doing so should fix any configuration
details left behind if the repository was previously updated to a new
Nx version without using `nx migrate`.
If your repository has only ever updated to newer versions of Nx with
`nx migrate`, running `nx repair` should do nothing.

Usage:

Terminal window
nx repair
OptionTypeDescriptionDefault
--helpbooleanShow help
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Reports useful version numbers to copy into the Nx issue template.

Usage:

Terminal window
nx report

Clears cached Nx artifacts and metadata about the workspace and shuts down the Nx Daemon.

Usage:

Terminal window
nx reset

Clears the internal state of the daemon and metadata that Nx is tracking. Helpful if you are getting strange errors and want to start fresh:

Terminal window
nx reset

Clears the Nx Cache directory. This will remove all local cache entries for tasks, but will not affect the remote cache:

Terminal window
nx reset --only-cache

Stops the Nx Daemon, it will be restarted fresh when the next Nx command is run.:

Terminal window
nx reset --only-daemon

Clears the workspace data directory. Used by Nx to store cached data about the current workspace (e.g. partial results, incremental data, etc):

Terminal window
nx reset --only-workspace-data
OptionTypeDescriptionDefault
--helpbooleanShow help
--onlyCachebooleanClears the Nx cache directory. This will remove all local cache entries for tasks, but will not affect the remote cache.
--onlyCloudbooleanResets the Nx Cloud client. NOTE: Does not clear the remote cache.
--onlyDaemonbooleanStops the Nx Daemon and clears its workspace data, it will be restarted fresh when the next Nx command is run.
--onlyWorkspaceDatabooleanClears the workspace data directory. Used by Nx to store cached data about the current workspace (e.g. partial results, incremental data, etc).
--versionbooleanShow version number

Run a target for a project (e.g., nx run myapp:serve:production).

You can also use the infix notation to run a target:
(e.g., nx serve myapp --configuration=production)
You can skip the use of Nx cache by using the --skip-nx-cache option.

Usage:

Terminal window
nx run [project][:target][:configuration] [_..]

Run the target build for the myapp project:

Terminal window
nx run myapp:build

Run the target build for the myapp project, with production configuration:

Terminal window
nx run myapp:build:production

Preview the task graph that Nx would run inside a webview:

Terminal window
nx run myapp:build --graph

Save the task graph to a file:

Terminal window
nx run myapp:build --graph=output.json

Print the task graph to the console:

Terminal window
nx run myapp:build --graph=stdout

Run’s a target named build:test for the myapp project. Note the quotes around the target name to prevent “test” from being considered a configuration:

Terminal window
nx run myapp:"build:test"
OptionTypeDescriptionDefault
--batchbooleanRun task(s) in batches for executors which support batches.false
--configuration, -cstringThis is the configuration to use when performing tasks on projects.
--excludestringExclude certain projects from being processed.
--excludeTaskDependenciesbooleanSkips running dependent tasks first.false
--graphstringShow the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser. Pass “stdout” to print the results to the terminal.
--nxBailbooleanStop command execution after the first failed task.false
--nxIgnoreCyclesbooleanIgnore cycles in the task graph.false
--outputStylestringDefines how Nx emits outputs tasks logs. tui: enables the Nx Terminal UI, recommended for local development environments. dynamic-legacy: use dynamic-legacy output life cycle, previous content is overwritten or modified as new outputs are added, display minimal logs by default, always show errors. This output format is recommended for local development environments where tui is not supported. static: uses static output life cycle, no previous content is rewritten or modified as new outputs are added. This output format is recommened for CI environments. stream: nx by default logs output to an internal output stream, enable this option to stream logs to stdout / stderr. stream-without-prefixes: nx prefixes the project name the target is running on, use this option remove the project name prefix from output. (choices: tui, dynamic, dynamic-legacy, static, stream, stream-without-prefixes)
--parallelstringMax number of parallel processes [default is 3].
--projectstringTarget project.
--runnerstringThis is the name of the tasks runner configured in nx.json.
--skipNxCache, --disableNxCachebooleanRerun the tasks even when the results are available in the cache.false
--skipRemoteCache, --disableRemoteCachebooleanDisables the remote cache.false
--skipSyncbooleanSkips running the sync generators associated with the tasks.false
--tuibooleanEnable or disable the Nx Terminal UI.
--tuiAutoExitstringWhether or not to exit the TUI automatically after all tasks finish, and after how long. If set to true, the TUI will exit immediately. If set to false the TUI will not automatically exit. If set to a number, an interruptible countdown popup will be shown for that many seconds before the TUI exits.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Run target for multiple listed projects.

Usage:

Terminal window
nx run-many

Test all projects:

Terminal window
nx run-many -t test

Test proj1 and proj2 in parallel:

Terminal window
nx run-many -t test -p proj1 proj2

Test proj1 and proj2 in parallel using 5 workers:

Terminal window
nx run-many -t test -p proj1 proj2 --parallel=5

Test proj1 and proj2 in sequence:

Terminal window
nx run-many -t test -p proj1 proj2 --parallel=false

Test all projects ending with *-app except excluded-app. Note: your shell may require you to escape the * like this: \*:

Terminal window
nx run-many -t test --projects=*-app --exclude excluded-app

Test all projects with tags starting with api-. Note: your shell may require you to escape the * like this: \*:

Terminal window
nx run-many -t test --projects=tag:api-*

Test all projects with a type:ui tag:

Terminal window
nx run-many -t test --projects=tag:type:ui

Test all projects with a type:feature or type:ui tag:

Terminal window
nx run-many -t test --projects=tag:type:feature,tag:type:ui

Run lint, test, and build targets for all projects. Requires Nx v15.4+:

Terminal window
nx run-many --targets=lint,test,build

Preview the task graph that Nx would run inside a webview:

Terminal window
nx run-many -t=build --graph

Save the task graph to a file:

Terminal window
nx run-many -t=build --graph=output.json

Print the task graph to the console:

Terminal window
nx run-many -t=build --graph=stdout
OptionTypeDescriptionDefault
--allboolean[deprecated] run-many runs all targets on all projects in the workspace if no projects are provided. This option is no longer required.true
--batchbooleanRun task(s) in batches for executors which support batches.false
--configuration, -cstringThis is the configuration to use when performing tasks on projects.
--excludestringExclude certain projects from being processed.
--excludeTaskDependenciesbooleanSkips running dependent tasks first.false
--graphstringShow the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser. Pass “stdout” to print the results to the terminal.
--helpbooleanShow help
--nxBailbooleanStop command execution after the first failed task.false
--nxIgnoreCyclesbooleanIgnore cycles in the task graph.false
--outputStylestringDefines how Nx emits outputs tasks logs. tui: enables the Nx Terminal UI, recommended for local development environments. dynamic-legacy: use dynamic-legacy output life cycle, previous content is overwritten or modified as new outputs are added, display minimal logs by default, always show errors. This output format is recommended for local development environments where tui is not supported. static: uses static output life cycle, no previous content is rewritten or modified as new outputs are added. This output format is recommened for CI environments. stream: nx by default logs output to an internal output stream, enable this option to stream logs to stdout / stderr. stream-without-prefixes: nx prefixes the project name the target is running on, use this option remove the project name prefix from output. (choices: dynamic-legacy, dynamic, tui, static, stream, stream-without-prefixes)
--parallelstringMax number of parallel processes [default is 3].
--projects, -pstringProjects to run. (comma/space delimited project names and/or patterns).
--runnerstringThis is the name of the tasks runner configured in nx.json.
--skipNxCache, --disableNxCachebooleanRerun the tasks even when the results are available in the cache.false
--skipRemoteCache, --disableRemoteCachebooleanDisables the remote cache.false
--skipSyncbooleanSkips running the sync generators associated with the tasks.false
--targets, --target, -tstringTasks to run for affected projects.
--tuibooleanEnable or disable the Nx Terminal UI.
--tuiAutoExitstringWhether or not to exit the TUI automatically after all tasks finish, and after how long. If set to true, the TUI will exit immediately. If set to false the TUI will not automatically exit. If set to a number, an interruptible countdown popup will be shown for that many seconds before the TUI exits.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Show information about the workspace (e.g., list of projects).

Usage:

Terminal window
nx show

Show all projects in the workspace:

Terminal window
nx show projects

Show all projects with names starting with “api-”. The “projects” option is useful to see which projects would be selected by run-many:

Terminal window
nx show projects --projects api-*

Show all projects with a tag starting with “ui-”. The “projects” option is useful to see which projects would be selected by run-many:

Terminal window
nx show projects --projects tag:ui-*

Show all projects with a serve target:

Terminal window
nx show projects --with-target serve

Show affected projects in the workspace:

Terminal window
nx show projects --affected

Show affected apps in the workspace:

Terminal window
nx show projects --affected --type app

Show affected projects in the workspace, excluding end-to-end projects:

Terminal window
nx show projects --affected --exclude=*-e2e

If in an interactive terminal, opens the project detail view. If not in an interactive terminal, defaults to JSON:

Terminal window
nx show project my-app

Show detailed information about “my-app” in a json format:

Terminal window
nx show project my-app --json

Show information about “my-app” in a human readable format:

Terminal window
nx show project my-app --json false

Opens a web browser to explore the configuration of “my-app”:

Terminal window
nx show project my-app --web
OptionTypeDescriptionDefault
--helpbooleanShow help
--jsonbooleanOutput JSON.
--versionbooleanShow version number

Shows resolved project configuration for a given project. If run within a project directory and no project name is provided, the project is inferred from the current working directory.

Usage:

Terminal window
nx project [projectName]
OptionTypeDescriptionDefault
--helpbooleanShow help
--openbooleanSet to false to prevent the browser from opening when using —web.
--projectName, -pstringThe project to show. If not provided, infers the project from the current working directory.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number
--webbooleanShow project details in the browser. (default when interactive).

Show a list of projects in the workspace.

Usage:

Terminal window
nx projects
OptionTypeDescriptionDefault
--affectedbooleanShow only affected projects.
--basestringBase of the current branch (usually main).
--excludestringExclude certain projects from being processed.
--filesstringChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces.
--helpbooleanShow help
--projects, -pstringShow only projects that match a given pattern.
--sepstringOutputs projects with the specified seperator.
--typestringSelect only projects of the given type. (choices: app, lib, e2e)
--uncommittedbooleanUncommitted changes.
--untrackedbooleanUntracked changes.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number
--withTarget, -tstringShow only projects that have a specific target.

Starts a new agent for distributed task execution. This command is an alias for nx-cloud start-agent.

Usage:

Terminal window
nx start-agent [options]
OptionTypeDescriptionDefault
--helpbooleanShow help.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Starts a new CI run for distributed task execution. This command is an alias for nx-cloud start-ci-run.

Usage:

Terminal window
nx start-ci-run [options]
OptionTypeDescriptionDefault
--helpbooleanShow help.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Terminates all dedicated agents associated with this CI pipeline execution. This command is an alias for nx-cloud stop-all-agents.

Usage:

Terminal window
nx stop-all-agents [options]
OptionTypeDescriptionDefault
--helpbooleanShow help.
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Sync the workspace files by running all the sync generators.

Usage:

Terminal window
nx sync
OptionTypeDescriptionDefault
--helpbooleanShow help
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Check that no changes are required after running all sync generators.

Usage:

Terminal window
nx sync:check
OptionTypeDescriptionDefault
--helpbooleanShow help
--verbosebooleanPrints additional information about the commands (e.g., stack traces).
--versionbooleanShow version number

Enables you to view and interact with the logs via the advanced analytic UI from Nx Cloud to help you debug your issue. To do this, Nx needs to connect your workspace to Nx Cloud and upload the most recent run details. Only the metrics are uploaded, not the artefacts.

Usage:

Terminal window
nx view-logs

Watch for changes within projects, and execute commands.

Usage:

Terminal window
nx watch

Watch the “app” project and echo the project name and the files that changed:

Terminal window
nx watch --projects=app -- echo \$NX_PROJECT_NAME \$NX_FILE_CHANGES

Watch “app1” and “app2” and echo the project name whenever a specified project or its dependencies change:

Terminal window
nx watch --projects=app1,app2 --includeDependentProjects -- echo \$NX_PROJECT_NAME

Watch all projects (including newly created projects) in the workspace:

Terminal window
nx watch --all -- echo \$NX_PROJECT_NAME
OptionTypeDescriptionDefault
--allbooleanWatch all projects.
--helpbooleanShow help
--includeDependentProjects, -dbooleanWhen watching selected projects, include dependent projects as well.
--initialRun, -ibooleanRun the command once before watching for changes.false
--projects, -pstringProjects to watch (comma/space delimited).
--verbosebooleanRun watch mode in verbose mode, where commands are logged before execution.
--versionbooleanShow version number

You can get help for any command by adding the --help flag:

Terminal window
nx <command> --help