Skip to main content

Documentation 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 reads environment variables to control its behavior without requiring changes to configuration files. Variables set in the environment always take precedence over equivalent settings in nx.json.
You can also set variables in .env, .local.env, or .env.local files at the workspace root. Nx loads these automatically unless NX_LOAD_DOT_ENV_FILES=false.

Core Nx variables

These variables affect the Nx CLI’s core behavior: task execution, caching, and the project graph.
NX_SKIP_NX_CACHE
boolean
Re-run tasks even when cached results are available. Equivalent to passing --skip-nx-cache on the command line.
NX_DISABLE_NX_CACHE
boolean
Alias for NX_SKIP_NX_CACHE.
NX_CACHE_DIRECTORY
string
Override the local task output cache directory. Defaults to .nx/cache. Equivalent to cacheDirectory in nx.json.
NX_MAX_CACHE_SIZE
string
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.
NX_WORKSPACE_DATA_DIRECTORY
string
Override the directory used for the project graph cache and other internal Nx caches. Defaults to .nx/workspace-data.
NX_SKIP_REMOTE_CACHE
boolean
Disable all remote caching. The remote cache (Nx Cloud or self-hosted) will not be read from or written to.
NX_DISABLE_REMOTE_CACHE
boolean
Alias for NX_SKIP_REMOTE_CACHE.
NX_CACHE_PROJECT_GRAPH
boolean
Set to false to disable the project graph cache. Useful when developing a plugin that modifies the project graph.
NX_PARALLEL
number
Number of tasks to run in parallel. Overrides parallel in nx.json and the --parallel flag.
NX_TASKS_RUNNER
string
Name of the tasks runner from nx.json to use. Preferred over NX_RUNNER. Can also be set with --runner on the command line.
NX_RUNNER
string
Deprecated alias for NX_TASKS_RUNNER.
NX_IGNORE_CYCLES
boolean
Set to true to ignore circular dependency errors in the task graph. Equivalent to --nxIgnoreCycles.
NX_BATCH_MODE
boolean
Run tasks in batches for executors that support batch execution.
NX_DEFAULT_PROJECT
string
The project used when no project is specified, e.g. bare nx build. Overrides defaultProject in nx.json.
NX_BASE
string
The base git ref used by nx affected to compute changed projects. Overrides defaultBase in nx.json and --base on the command line.
NX_HEAD
string
The head git ref used by nx affected. Overrides --head on the command line.
NX_ADD_PLUGINS
boolean
default:"true"
Set to false to prevent Nx from adding inference plugins when generating new projects.
NX_DAEMON
boolean
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.
NX_VERBOSE_LOGGING
boolean
Print debug information useful for troubleshooting task execution and configuration issues.
NX_PERF_LOGGING
boolean
Print performance profiling information for executors and Nx internals.
NX_PROFILE
string
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.
NX_DEFAULT_OUTPUT_STYLE
string
Default output style when running tasks. Overrides --outputStyle.
NX_TASKS_RUNNER_DYNAMIC_OUTPUT
boolean
Set to false to use the non-dynamic (CI-style) output even in terminals that support dynamic output.
NX_SKIP_LOG_GROUPING
boolean
Set to true to prevent Nx from grouping task logs on CI.
NX_TUI
boolean
Enable (true) or disable (false) the interactive Terminal UI. Overrides tui.enabled in nx.json.
NX_TUI_AUTO_EXIT
boolean | number
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.
NX_DRY_RUN
boolean
Perform a dry run of a generator — no files are created and no packages are installed.
NX_INTERACTIVE
boolean
Allow Nx to prompt for additional input when running generators.
NX_GENERATE_QUIET
boolean
Suppress file operation logs during nx generate.
NX_SKIP_FORMAT
boolean
Skip Prettier formatting in generators and migrations. Useful when using an alternative formatter such as Biome or dprint.
NX_MIGRATE_SKIP_INSTALL
boolean
Prevent nx migrate --run-migrations from automatically installing packages.
NX_MIGRATE_USE_LOCAL
boolean
Use the locally installed nx version instead of downloading the latest when running nx migrate.
NX_MIGRATE_CLI_VERSION
string
The version of Nx to use for nx migrate. Defaults to "latest".
NX_MIGRATE_SKIP_REGISTRY_FETCH
boolean
Skip fetching package metadata from the registry during migration.
NX_LOAD_DOT_ENV_FILES
boolean
Set to false to prevent Nx from loading .env, .local.env, and .env.local files.
NX_USE_LOCAL
boolean
Use the locally installed Nx version instead of downloading the latest for commands such as nx init and nx migrate.
NX_PREFER_TS_NODE
boolean
Force Nx to use ts-node to execute TypeScript plugin files, even when @swc-node/register is installed.
NX_PREFER_NODE_STRIP_TYPES
boolean
Use Node.js native TypeScript type stripping (Node.js 22.6+) instead of @swc-node/register or ts-node. Improves startup performance.
NX_NATIVE_FILE_CACHE_DIRECTORY
string
Override the directory where native .node binary files are cached. Interpreted as an absolute path.
NX_FORMAT_SORT_TSCONFIG_PATHS
boolean
Sort TypeScript path mappings in the root tsconfig file when generators run.
NX_PLUGIN_NO_TIMEOUTS
boolean
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.
VariableTypeDescription
NX_TASK_TARGET_PROJECTstringThe name of the project being run.
NX_TASK_TARGET_TARGETstringThe target name being run (e.g. build, test).
NX_TASK_TARGET_CONFIGURATIONstringThe configuration name being used (e.g. production).
NX_GRAPH_CREATIONbooleantrue while the project graph is being constructed. Use to run different code paths in inference plugins.
NX_DRY_RUNbooleantrue during generator dry runs. Use to skip side effects.
NX_INTERACTIVEbooleanfalse 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).
VariableDescription
NX_DOTNET_DISABLEDisable the @nx/dotnet plugin.
NX_GRADLE_DISABLEDisable the @nx/gradle plugin.
NX_MAVEN_DISABLEDisable 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.
NX_CLOUD_ACCESS_TOKEN
string
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.
NX_CLOUD_API
string
URL of the Nx Cloud instance. Overrides nxCloudUrl in nx.json. Use for self-hosted Nx Cloud deployments.
NX_CLOUD_ENCRYPTION_KEY
string
Encryption key for end-to-end encryption of cached artifacts. Also configurable via nxCloudEncryptionKey in nx.json.
NX_NO_CLOUD
boolean
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.
NX_BRANCH
string
The current branch name. Auto-detected for most CI providers. Must be set to the PR number for GitHub, Bitbucket, and GitLab PR integrations.
NX_CI_EXECUTION_ID
string
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.
NX_CI_EXECUTION_ENV
string
Distinguishes multiple main jobs (e.g. Linux vs Windows). Agents with a matching value will be assigned tasks from the corresponding main job.
NX_WORKING_DIRECTORY
string
Subdirectory containing the Nx workspace, when the workspace is not at the repository root. Only used by Nx Agents.
NX_AGENT_LAUNCH_TEMPLATE
string
Attaches a launch template type to agents for Manual DTE assignment rules.
NX_CLOUD_DISABLE_METRICS_COLLECTION
boolean
Disable collection of CPU and memory metrics during task execution. Metrics are enabled by default for enterprise users on Nx 22.1+.
NX_CLOUD_METRICS_DIRECTORY
string
Directory where Nx writes resource usage metrics during task execution.
NX_CLOUD_NO_TIMEOUTS
boolean
Disable the default 10-second timeout for Nx Cloud requests.

Deprecated Nx Cloud variables

These variables are deprecated. Migrate to the recommended alternatives.
VariableReplacementDescription
NX_RUN_GROUPNX_CI_EXECUTION_ID + NX_CI_EXECUTION_ENVOlder CI run group identifier.
NX_CLOUD_DISTRIBUTED_EXECUTION--no-dte / --no-agents flagsSetting to false disabled distributed execution.
NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE--stop-agents-on-failure flagStopped agents on failure.