Nx reads environment variables to control its behavior without requiring changes to configuration files. Variables set in the environment always take precedence over equivalent settings inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nrwl/nx/llms.txt
Use this file to discover all available pages before exploring further.
nx.json.
Core Nx variables
These variables affect the Nx CLI’s core behavior: task execution, caching, and the project graph.Caching
Caching
Re-run tasks even when cached results are available. Equivalent to
passing
--skip-nx-cache on the command line.Alias for
NX_SKIP_NX_CACHE.Override the local task output cache directory. Defaults to
.nx/cache.
Equivalent to cacheDirectory in nx.json.Maximum local cache size. Accepts byte values or unit suffixes such as
"100MB" or "1GB". Overrides maxCacheSize in nx.json. See
nx.json reference for supported units.Override the directory used for the project graph cache and other
internal Nx caches. Defaults to
.nx/workspace-data.Disable all remote caching. The remote cache (Nx Cloud or self-hosted)
will not be read from or written to.
Alias for
NX_SKIP_REMOTE_CACHE.Set to
false to disable the project graph cache. Useful when
developing a plugin that modifies the project graph.Task execution
Task execution
Number of tasks to run in parallel. Overrides
parallel in nx.json
and the --parallel flag.Name of the tasks runner from
nx.json to use. Preferred over
NX_RUNNER. Can also be set with --runner on the command line.Deprecated alias for
NX_TASKS_RUNNER.Set to
true to ignore circular dependency errors in the task graph.
Equivalent to --nxIgnoreCycles.Run tasks in batches for executors that support batch execution.
Project graph
Project graph
The project used when no project is specified, e.g. bare
nx build.
Overrides defaultProject in nx.json.The base git ref used by
nx affected to compute changed projects.
Overrides defaultBase in nx.json and --base on the command line.The head git ref used by
nx affected. Overrides --head on the
command line.Set to
false to prevent Nx from adding inference plugins when
generating new projects.Daemon
Daemon
Set to
false to disable the Nx daemon. The daemon speeds up project
graph computation by running as a background process. Disable it to
print console.log statements in plugin code during development.Output and logging
Output and logging
Print debug information useful for troubleshooting task execution and
configuration issues.
Print performance profiling information for executors and Nx internals.
Path for a JSON performance profile file (e.g.
NX_PROFILE=profile.json).
Load the file in Chrome DevTools to visualize task execution across
processes.Default output style when running tasks. Overrides
--outputStyle.Set to
false to use the non-dynamic (CI-style) output even in
terminals that support dynamic output.Set to
true to prevent Nx from grouping task logs on CI.Terminal UI (TUI)
Terminal UI (TUI)
Enable (
true) or disable (false) the interactive Terminal UI.
Overrides tui.enabled in nx.json.Controls automatic TUI exit after tasks finish.
true exits immediately;
false never exits automatically; a number shows a countdown.
Overrides tui.autoExit in nx.json.Generators and migrations
Generators and migrations
Perform a dry run of a generator — no files are created and no packages
are installed.
Allow Nx to prompt for additional input when running generators.
Suppress file operation logs during
nx generate.Skip Prettier formatting in generators and migrations. Useful when using
an alternative formatter such as Biome or dprint.
Prevent
nx migrate --run-migrations from automatically installing
packages.Use the locally installed
nx version instead of downloading the latest
when running nx migrate.The version of Nx to use for
nx migrate. Defaults to "latest".Skip fetching package metadata from the registry during migration.
Other
Other
Set to
false to prevent Nx from loading .env, .local.env, and
.env.local files.Use the locally installed Nx version instead of downloading the latest
for commands such as
nx init and nx migrate.Force Nx to use
ts-node to execute TypeScript plugin files, even when
@swc-node/register is installed.Use Node.js native TypeScript type stripping (Node.js 22.6+) instead of
@swc-node/register or ts-node. Improves startup performance.Override the directory where native
.node binary files are cached.
Interpreted as an absolute path.Sort TypeScript path mappings in the root
tsconfig file when generators
run.Disable timeouts for plugin operations.
Variables set by Nx during task execution
Nx injects the following variables into the process environment when running tasks. They are available inside executors, generators, and any script invoked by a task.| Variable | Type | Description |
|---|---|---|
NX_TASK_TARGET_PROJECT | string | The name of the project being run. |
NX_TASK_TARGET_TARGET | string | The target name being run (e.g. build, test). |
NX_TASK_TARGET_CONFIGURATION | string | The configuration name being used (e.g. production). |
NX_GRAPH_CREATION | boolean | true while the project graph is being constructed. Use to run different code paths in inference plugins. |
NX_DRY_RUN | boolean | true during generator dry runs. Use to skip side effects. |
NX_INTERACTIVE | boolean | false when generators run with --interactive=false. |
Plugin disable variables
Use these variables to disable specific built-in Nx plugins in environments where the required toolchain is unavailable (e.g. a CI agent without Java).| Variable | Description |
|---|---|
NX_DOTNET_DISABLE | Disable the @nx/dotnet plugin. |
NX_GRADLE_DISABLE | Disable the @nx/gradle plugin. |
NX_MAVEN_DISABLE | Disable the @nx/maven plugin. |
Nx Cloud variables
These variables configure integration with Nx Cloud for remote caching and distributed task execution.Nx Cloud also respects
NX_VERBOSE_LOGGING to output debug information about
agent communication and cache operations.Authentication and connection
Authentication and connection
Nx Cloud access token. Takes precedence over
accessToken in nx.json.
A common pattern is to store a read-only token in nx.json and set a
read-write token here in CI.URL of the Nx Cloud instance. Overrides
nxCloudUrl in nx.json. Use
for self-hosted Nx Cloud deployments.Encryption key for end-to-end encryption of cached artifacts. Also
configurable via
nxCloudEncryptionKey in nx.json.Prevent Nx Cloud from being used for the current run. No remote cache
will be read or written. Cannot be used with distributed task execution.
CI integration
CI integration
The current branch name. Auto-detected for most CI providers. Must be set
to the PR number for GitHub, Bitbucket, and GitLab PR integrations.
A unique identifier for the current CI run. Auto-detected for most CI
providers. The main job and all agents must share the same value.
Distinguishes multiple main jobs (e.g. Linux vs Windows). Agents with a
matching value will be assigned tasks from the corresponding main job.
Subdirectory containing the Nx workspace, when the workspace is not at
the repository root. Only used by Nx Agents.
Attaches a launch template type to agents for Manual DTE assignment rules.
Metrics and diagnostics
Metrics and diagnostics
Disable collection of CPU and memory metrics during task execution.
Metrics are enabled by default for enterprise users on Nx 22.1+.
Directory where Nx writes resource usage metrics during task execution.
Disable the default 10-second timeout for Nx Cloud requests.
Deprecated Nx Cloud variables
| Variable | Replacement | Description |
|---|---|---|
NX_RUN_GROUP | NX_CI_EXECUTION_ID + NX_CI_EXECUTION_ENV | Older CI run group identifier. |
NX_CLOUD_DISTRIBUTED_EXECUTION | --no-dte / --no-agents flags | Setting to false disabled distributed execution. |
NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE | --stop-agents-on-failure flag | Stopped agents on failure. |
