Skip to content

Nx Environment Variables

The following environment variables are ones that you can set to change the behavior of Nx in different environments. Everyday settings are listed under Common. Settings for debugging, internals, and specialized tooling are under Advanced.

PropertyTypeDescription
NX_BAILbooleanIf set to true, Nx will stop command execution after the first failed task. Can be overridden on the command line with --nxBail.
NX_BASEstringThe default base branch to use when calculating the affected projects. Can be overridden on the command line with --base.
NX_BATCH_MODEbooleanIf set to true, Nx will run task(s) in batches for executors which support batches.
NX_CACHE_DIRECTORYstringThe cache for task outputs is stored in .nx/cache by default. Set this variable to use a different directory.
NX_CACHE_FAILURESbooleanIf set to true, Nx caches failing tasks in addition to successful ones.
NX_DAEMONbooleanIf set to false, disables the Nx daemon process. Disable the daemon to print console.log statements in plugin code you are developing.
NX_DEFAULT_OUTPUT_STYLEstringThe default output style to use when running tasks. Can be overridden on the command line with --outputStyle.
NX_DEFAULT_PROJECTstringThe default project used for commands which require a project. e.g. nx build, nx g component, etc.
NX_DISABLE_NX_CACHEbooleanRerun the tasks even when the results are available in the cache.
NX_DISABLE_REMOTE_CACHEbooleanDisable all remote caching features. This means that the remote cache will not be read from or written to. Includes Nx Cloud and self-hosted caches.
NX_DRY_RUNbooleanIf set to true, will perform a dry run of the generator. No files will be created and no packages will be installed.
NX_HEADstringThe default head branch to use when calculating the affected projects. Can be overridden on the command line with --head.
NX_IGNORE_CYCLESbooleanIf set to true, Nx will ignore errors created by a task graph circular dependency. Can be overridden on the command line with --nxIgnoreCycles
NX_INTERACTIVEbooleanIf set to true, will allow Nx to prompt you in the terminal to answer some further questions when running generators.
NX_LOAD_DOT_ENV_FILESbooleanIf set to 'false', Nx will not load any environment files (e.g. .local.env, .env.local)
NX_MAX_CACHE_SIZEstringAlternative to configuring maxCacheSize in nx.json. Defines the maximum size of the local task cache. See maxCacheSize for supported units and behavior details.
NX_MIGRATE_CLI_VERSIONstringThe version of Nx to use for running the nx migrate command. If not set, it defaults to latest.
NX_MIGRATE_SKIP_INSTALLbooleanIf set to true, nx migrate --run-migrations will not automatically perform the installation of the packages.
NX_MIGRATE_USE_LOCALbooleanIf set to true, will use the locally installed version of nx instead of downloading the latest version to run the nx migrate command.
NX_PARALLELnumberThe number of tasks Nx should run in parallel. Overrides any configured value inside nx.json
NX_SKIP_NX_CACHEbooleanRerun the tasks even when the results are available in the cache.
NX_SKIP_REMOTE_CACHEbooleanDisable all remote caching features. This means that the remote cache will not be read from or written to. Includes Nx Cloud and self-hosted caches.
NX_TUIbooleanIf set to true or false, will enable or disable the Terminal UI (TUI) for running tasks. TUI provides an interactive visual interface for task execution
NX_TUI_AUTO_EXITboolean/numberControls whether the TUI automatically exits after tasks finish. If true, exits immediately. If false, never exits automatically. If a number, shows a countdown for that many seconds before exiting
NX_USE_LOCALbooleanIf set to true, Nx will use the locally installed version instead of downloading the latest version from npm for commands like nx init and nx migrate.
NX_VERBOSE_LOGGINGbooleanIf set to true, will print debug information useful for troubleshooting
NX_WORKSPACE_DATA_DIRECTORYstringThe project graph cache and some other internal nx caches are stored in .nx/workspace-data by default. Set this variable to use a different directory.
PropertyTypeDescription
NX_ADD_PLUGINSbooleanIf set to false, Nx will not add plugins to infer tasks. This is true by default.
NX_CACHE_PROJECT_GRAPHbooleanIf set to false, disables the project graph cache. Most useful when developing a plugin that modifies the project graph.
NX_DAEMON_SOCKET_DIRstringAlias of NX_SOCKET_DIR, used only when NX_SOCKET_DIR is not set. Despite the name, it controls all Nx socket placements, not just the daemon socket. Prefer NX_SOCKET_DIR in new setups.
NX_FORCE_REUSE_CACHED_GRAPHbooleanIf set to true, Nx will reuse an existing cached project graph when available and skip recomputing it. Useful in short-lived CI steps that run immediately after a step which already computed the graph.
NX_FORMAT_SORT_TSCONFIG_PATHSbooleanIf set to true, generators will sort the TypeScript path mappings in the root tsconfig file.
NX_GENERATE_QUIETbooleanIf set to true, will prevent Nx logging file operations during generate
NX_ISOLATE_PLUGINSbooleanForces plugin isolation on or off, overriding the automatic detection. Set to true to always run inference plugins in isolated workers, or false to always run them in-process.
NX_MIGRATE_INSTALL_CONCURRENCYnumberLimits the number of concurrent package installs when fetching migration metadata. Useful for avoiding package manager cache conflicts on Windows with private registries. If not set, installs run with no concurrency limit.
NX_MIGRATE_SKIP_REGISTRY_FETCHbooleanIf set to true, will skip fetching metadata from the registry and instead use the installation method directly.
NX_NATIVE_COMMAND_RUNNERbooleanIf set to false, disables the native pseudo-terminal command runner and falls back to the standard Node.js child process. Enabled by default.
NX_NATIVE_FILE_CACHE_DIRECTORYstringThe cache for native .node files is stored under a global temp directory by default. Set this variable to use a different directory. This is interpreted as an absolute path.
NX_NATIVE_FILE_LOGGINGstringEnables the native (Rust) tracing logger and writes logs to .nx/workspace-data/nx.log. Accepts the same filter directives as NX_NATIVE_LOGGING (e.g. debug, info, [{project_name=myapp}]). Useful for debugging native code paths.
NX_NATIVE_LOGGINGstringFilter directive for the native (Rust) tracing logger. Defaults to nx::native=info. Set to a log level (trace, debug, info, warn, error, off) to control all native logs, or scope by crate or module (e.g. nx=trace, nx::native::tasks::hashers=debug, [{project_name=myapp}]).
NX_PERF_LOGGINGbooleanIf set to true, will print debug information useful for profiling executors and Nx itself
NX_PLUGIN_NO_TIMEOUTSbooleanIf set to true, plugin operations will not timeout
NX_PREFER_NODE_STRIP_TYPESbooleanIf set to true and running on Node.js 22.6+, Nx will use Node.js native TypeScript type stripping instead of @swc-node/register or ts-node when loading TypeScript configuration files. This improves performance.
NX_PREFER_TS_NODEbooleanIf set to true, Nx will use ts-node for local execution of plugins even if @swc-node/register is installed.
NX_PROFILEstringPrepend NX_PROFILE=profile.json before running targets with Nx to generate a file that be loaded in Chrome dev tools to visualize the performance of Nx across multiple processes.
NX_REJECT_UNKNOWN_LOCAL_CACHEbooleanLegacy cache safety toggle. Set to 0 or false to allow reading a local cache that wasn't populated by the current machine. Not supported with the new database cache. See legacy cache.
NX_RUNNERstringThe name of task runner from the config to use. Can be overridden on the command line with --runner. Not read if NX_TASKS_RUNNER is set.
NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKENstringBearer token passed as the Authorization header when contacting the self-hosted remote cache server configured via NX_SELF_HOSTED_REMOTE_CACHE_SERVER.
NX_SELF_HOSTED_REMOTE_CACHE_SERVERstringURL of a self-hosted remote cache server. When set, Nx uses this endpoint for remote cache reads and writes instead of Nx Cloud.
NX_SKIP_ATOMIZER_VALIDATIONbooleanIf set to true, suppresses the atomizer warning Nx shows when Nx Cloud isn't configured.
NX_SKIP_FORMATbooleanIf set to true, skips Prettier formatting in generators and migrations. Useful for repositories that use alternative formatters like Biome, dprint, or have custom formatting requirements.
NX_SKIP_LOG_GROUPINGbooleanIf set to true, Nx will not group command's logs on CI.
NX_SKIP_NATIVE_FILE_CACHEbooleanIf set to true, disables the native .node file cache. Nx otherwise copies native bindings to a cache directory to avoid file-locking issues when multiple processes load them.
NX_SKIP_PROVENANCE_CHECKbooleanIf set to true, skips npm provenance verification when installing packages during nx migrate. This is a security-sensitive check. Only disable it if you understand the implications.
NX_SKIP_VSCODE_EXTENSION_INSTALLbooleanIf set to true, skips the automatic installation of the Nx Console extension for supported editors. Set this in environments where the temp file that we store this information in otherwise isn't accessible.
NX_SOCKET_DIRstringDirectory for all Nx sockets (daemon, forked process, and plugin). Set this to a shorter path when the default temp directory produces a socket path that exceeds the OS limit. Takes precedence over NX_DAEMON_SOCKET_DIR.
NX_TASKS_RUNNERstringThe name of task runner from the config to use. Can be overridden on the command line with --runner. Preferred over NX_RUNNER.
NX_TASKS_RUNNER_DYNAMIC_OUTPUTbooleanIf set to false, will use non-dynamic terminal output strategy (what you see in CI), even when you terminal can support the dynamic version
NX_USE_V8_SERIALIZERbooleanIf set to true, Nx will use v8 serialization in the pseudo-IPC channel between the daemon and task processes instead of JSON. Improves throughput for workspaces with large task payloads.
NX_WRAPPER_SKIP_INSTALLbooleanIf set to true, the .nx/nxw.js wrapper skips verifying and self-installing the pinned Nx version before each command.

The following environment variables can be used to configure specific Nx plugins. This is useful in CI environments where the required tooling (e.g., Java) is not available or where plugin behavior needs to be customized.

PropertyTypeDescription
NX_DOTNET_DISABLEbooleanIf set to true, disables the @nx/dotnet plugin. Useful in environments where .NET SDK is not available.
NX_GRADLE_DISABLEbooleanIf set to true, disables the @nx/gradle plugin. Useful in environments where Java/Gradle is not available.
NX_GRADLE_PROJECT_GRAPH_TIMEOUTnumberTimeout in seconds for Gradle project graph generation. Defaults to 60. Increase this value for large Gradle workspaces that need more time to resolve.
NX_MAVEN_DISABLEbooleanIf set to true, disables the @nx/maven plugin. Useful in environments where Java/Maven is not available.

Nx will set the following environment variables so they can be accessible within the process even outside of executors and generators.

PropertyTypeDescription
NX_TASK_TARGET_PROJECTstringSet to the project name of the task being run. Use this to tell which project is being run.
NX_TASK_TARGET_TARGETstringSet to the target name of the task being run. Use this to tell which target of the project is being run.
NX_TASK_TARGET_CONFIGURATIONstringSet to the configuration name of the task being run. Use this to tell which configuration of the target is being run.
NX_GRAPH_CREATIONbooleanSet to true during the graph creation process. Use this to have inference plugins run different code during graph creation versus during task execution
NX_DRY_RUNbooleanSet to true during dry runs of generators. Use this to avoid side effects during generators.
NX_INTERACTIVEbooleanSet to false when running generators with --interactive=false. Use this to prevent prompting during generators
NX_RUNNING_NX_IMPORTbooleanSet to true while the nx import command is executing. Use this to have plugin code or scripts behave differently during an import (e.g. adjust telemetry or logging).
NX_RUNNING_NX_INITbooleanSet to true while the nx init command is executing. Use this to have plugin code or scripts behave differently during workspace initialization.

The following environment variables are specific to Nx Cloud and can be used to configure cloud-specific behavior:

PropertyTypeDescription
NX_BRANCHstringThe current branch name. For most CI providers, nx-cloud determines this automatically. Must be set to the PR number for GitHub, BitBucket and GitLab integrations to work properly.
NX_CLOUD_DISABLE_METRICS_COLLECTIONbooleanDisables collection of CPU and memory metrics during task execution (enabled by default for enterprise users on Nx 22.1+). See Task Resource Usage.
NX_CLOUD_METRICS_DIRECTORYstringDirectory where Nx writes resource metrics during task execution. See Task Resource Usage.
NX_CI_EXECUTION_IDstringA unique identifier for the current CI run or job. For most CI providers, nx-cloud determines this automatically. The value on the main job must match the value on all agents.
NX_CI_EXECUTION_ENVstringUsed when you have multiple main jobs (e.g., running CI on both Linux and Windows). The main job with this env variable will connect to agents with the same env name.
NX_AGENT_LAUNCH_TEMPLATEstringShould only be used when running agents with Manual DTE. Attaches a launch template type to your agents to leverage assignment rules for task distribution.
NX_CLOUD_ACCESS_TOKENstringConfigure the Nx Cloud access token. Takes precedence over the accessToken property in nx.json. Common to have a read-only token in nx.json and a read-write token set via this environment variable in CI.
NX_CLOUD_APIstringThe URL of the Nx Cloud instance to connect to. Overrides nxCloudUrl in nx.json.
NX_CLOUD_ENCRYPTION_KEYstringEnable end-to-end encryption of artifacts. Artifacts will be encrypted/decrypted on your machine. Can also be set via the encryptionKey property in nx.json.
NX_CLOUD_NO_TIMEOUTSbooleanDisables the default 10-second timeout for Nx Cloud requests.
NX_NO_OUTPUT_TIMEOUTstringOverrides the launch template's no-output-timeout for an Nx Agent step. Duration string (e.g., 10m, 1h); "0" disables.
NX_NO_CLOUDbooleanIf set to true, prevents Nx Cloud from being used for the current run. No remote cache will be used. Value cannot be set if using distributed task execution
NX_VERBOSE_LOGGINGbooleanOutputs debug information about agents communicating with the main job. Useful for debugging cache misses and on-premises setup issues.
NX_WORKING_DIRECTORYstringThe subdirectory containing your Nx workspace. Set this in your launch template if your Nx workspace is not at the repository root. Only used by Nx Agents.
NX_CLOUD_FORCE_REVALIDATEbooleanIf set to true, forces the Nx Cloud client updater to re-check for a new bundle on every run even when a cached bundle is still valid. Useful when testing new nx-cloud client releases.
NX_CLOUD_AGENT_TIMEOUT_MSnumberTimeout in milliseconds an agent waits to hear from Nx Cloud before erroring. Defaults to 3600000 (60 minutes).
NX_CLOUD_ORCHESTRATOR_TIMEOUT_MSnumberTimeout in milliseconds the orchestrator (main job) waits for a completed task response from Nx Cloud. Defaults to 3600000 (60 minutes).
NX_CLOUD_NUMBER_OF_RETRIESnumberHow many times Nx Cloud retries HTTP requests that fail with a transient error. Defaults to 10 on CI and 0 locally.
NX_CLOUD_DISTRIBUTED_EXECUTIONbooleanTypically not needed. When set to false, disables distributed task execution. Prefer the --no-dte or --no-agents flags.
PropertyTypeDescription
NX_RUN_GROUPstringOlder versions of nx-cloud used this instead of NX_CI_EXECUTION_ID and NX_CI_EXECUTION_ENV. Served the same purpose.
NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILUREbooleanWhen set to true, tells Nx Cloud to stop agents if a command fails. Use npx nx start-ci-run --stop-agents-on-failure=true instead.
NX_CLOUD_AUTH_TOKENstringNo longer needed. Use NX_CLOUD_ACCESS_TOKEN instead. Still read for backwards compatibility.
NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNTnumberNo longer needed. Nx Cloud now derives the agent count from the launch template and workspace configuration automatically.