The Nx CLI provides many commands. They are organized here into commands that:
There is also a section for separate commands that can create a new Nx workspace for you.
Parsing Nx Commands
If the command that you pass to Nx is not one of the keywords listed below, it will try to interpret the command as if it were a task. So Nx will parse your command in the following ways and execute the first syntax that is valid.
nx [built-in-command] [...arguments]
nx [task-name-for-root-project] [...arguments]
nx [task-name] [project-name] [...arguments]
These commands modify your codebase in some way.
initAdds Nx to any type of workspace. It installs nx, creates an nx.json
configuration file and optionally sets up remote caching.
Install a plugin and initialize it.
generateRuns a generator that creates and/or modifies files based on a generator from a plugin.
❯
nx generate @nx/react:component libs/my-lib/src/lib/my-component
migrateCreates a migrations file or runs migrations from the migrations file.
❯
nx migrate --run-migrations
importImport code and git history from another repository into this repository.
❯
nx import https://github.com/myorg/inventory-app.git apps/inventory
❯
nx import ../inventory-app apps/inventory
repairRepair 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.
syncRun all sync generators
formatOverwrite un-formatted files or check for un-formatted files
These commands run tasks on your code.
runRun a target for a project
run-manyRun target for multiple listed projects
❯
nx run-many --target=build
affectedRun target for affected projects
❯
nx affected --target=build
execExecutes any command as if it was a target on the project
package.json
{ "scripts": { "build": "nx exec -- node ./my-custom-build.js" } }
Watch for changes within projects, and execute commands
❯
nx watch --projects=assets -- nx build assets
releaseOrchestrate versioning and publishing of applications and libraries
resetClears cached Nx artifacts and metadata about the workspace and shuts down the Nx Daemon.
showShow information about the workspace (e.g., list of projects)
graphGraph dependencies within workspace
listLists installed plugins, capabilities of installed plugins and other available plugins.
reportReports useful version numbers to copy into the Nx issue template
daemonPrints information about the Nx Daemon process or starts a daemon process
mcpStarts the Nx MCP server for exposing Nx tools to various AI systems (VSCode, Cursor, Claude, ...)
connectConnect an Nx workspace to Nx Cloud
loginLogin to Nx Cloud. This command is an alias for nx-cloud login
.
Logout from Nx Cloud. This command is an alias for nx-cloud logout
.
Records command execution for distributed task execution. This command is an alias for nx-cloud record
.
❯
nx record -- nx run my-app:build
start-ci-runStarts a new CI run for distributed task execution. This command is an alias for nx-cloud start-ci-run
.
Fixes CI failures with AI-powered suggestions. This command is an alias for nx-cloud fix-ci
.
Create a new Nx workspace
❯
npx create-nx-workspace
create-nx-pluginCreate a new Nx workspace with a preset designed for writing an Nx plugin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4