Nx environment variables
Section titled “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.
Common
Section titled “Common”| Property | Type | Description |
|---|---|---|
NX_BAIL | boolean | If set to true, Nx will stop command execution after the first failed task. Can be overridden on the command line with --nxBail. |
NX_BASE | string | The default base branch to use when calculating the affected projects. Can be overridden on the command line with --base. |
NX_BATCH_MODE | boolean | If set to true, Nx will run task(s) in batches for executors which support batches. |
NX_CACHE_DIRECTORY | string | The cache for task outputs is stored in .nx/cache by default. Set this variable to use a different directory. |
NX_CACHE_FAILURES | boolean | If set to true, Nx caches failing tasks in addition to successful ones. |
NX_DAEMON | boolean | If 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_STYLE | string | The default output style to use when running tasks. Can be overridden on the command line with --outputStyle. |
NX_DEFAULT_PROJECT | string | The default project used for commands which require a project. e.g. nx build, nx g component, etc. |
NX_DISABLE_NX_CACHE | boolean | Rerun the tasks even when the results are available in the cache. |
NX_DISABLE_REMOTE_CACHE | boolean | Disable 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_RUN | boolean | If set to true, will perform a dry run of the generator. No files will be created and no packages will be installed. |
NX_HEAD | string | The default head branch to use when calculating the affected projects. Can be overridden on the command line with --head. |
NX_IGNORE_CYCLES | boolean | If set to true, Nx will ignore errors created by a task graph circular dependency. Can be overridden on the command line with --nxIgnoreCycles |
NX_INTERACTIVE | boolean | If set to true, will allow Nx to prompt you in the terminal to answer some further questions when running generators. |
NX_LOAD_DOT_ENV_FILES | boolean | If set to 'false', Nx will not load any environment files (e.g. .local.env, .env.local) |
NX_MAX_CACHE_SIZE | string | Alternative 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_VERSION | string | The version of Nx to use for running the nx migrate command. If not set, it defaults to latest. |
NX_MIGRATE_SKIP_INSTALL | boolean | If set to true, nx migrate --run-migrations will not automatically perform the installation of the packages. |
NX_MIGRATE_USE_LOCAL | boolean | If set to true, will use the locally installed version of nx instead of downloading the latest version to run the nx migrate command. |
NX_PARALLEL | number | The number of tasks Nx should run in parallel. Overrides any configured value inside nx.json |
NX_SKIP_NX_CACHE | boolean | Rerun the tasks even when the results are available in the cache. |
NX_SKIP_REMOTE_CACHE | boolean | Disable 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_TUI | boolean | If 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_EXIT | boolean/number | Controls 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_LOCAL | boolean | If 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_LOGGING | boolean | If set to true, will print debug information useful for troubleshooting |
NX_WORKSPACE_DATA_DIRECTORY | string | The 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. |
Advanced
Section titled “Advanced”| Property | Type | Description |
|---|---|---|
NX_ADD_PLUGINS | boolean | If set to false, Nx will not add plugins to infer tasks. This is true by default. |
NX_CACHE_PROJECT_GRAPH | boolean | If set to false, disables the project graph cache. Most useful when developing a plugin that modifies the project graph. |
NX_DAEMON_SOCKET_DIR | string | Alias 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_GRAPH | boolean | If 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_PATHS | boolean | If set to true, generators will sort the TypeScript path mappings in the root tsconfig file. |
NX_GENERATE_QUIET | boolean | If set to true, will prevent Nx logging file operations during generate |
NX_ISOLATE_PLUGINS | boolean | Forces 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_CONCURRENCY | number | Limits 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_FETCH | boolean | If set to true, will skip fetching metadata from the registry and instead use the installation method directly. |
NX_NATIVE_COMMAND_RUNNER | boolean | If 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_DIRECTORY | string | The 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_LOGGING | string | Enables 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_LOGGING | string | Filter 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_LOGGING | boolean | If set to true, will print debug information useful for profiling executors and Nx itself |
NX_PLUGIN_NO_TIMEOUTS | boolean | If set to true, plugin operations will not timeout |
NX_PREFER_NODE_STRIP_TYPES | boolean | If 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_NODE | boolean | If set to true, Nx will use ts-node for local execution of plugins even if @swc-node/register is installed. |
NX_PROFILE | string | Prepend 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_CACHE | boolean | Legacy 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_RUNNER | string | The 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_TOKEN | string | Bearer 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_SERVER | string | URL 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_VALIDATION | boolean | If set to true, suppresses the atomizer warning Nx shows when Nx Cloud isn't configured. |
NX_SKIP_FORMAT | boolean | If 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_GROUPING | boolean | If set to true, Nx will not group command's logs on CI. |
NX_SKIP_NATIVE_FILE_CACHE | boolean | If 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_CHECK | boolean | If 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_INSTALL | boolean | If 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_DIR | string | Directory 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_RUNNER | string | The 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_OUTPUT | boolean | If 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_SERIALIZER | boolean | If 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_INSTALL | boolean | If set to true, the .nx/nxw.js wrapper skips verifying and self-installing the pinned Nx version before each command. |
Plugin environment variables
Section titled “Plugin environment variables”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.
| Property | Type | Description |
|---|---|---|
NX_DOTNET_DISABLE | boolean | If set to true, disables the @nx/dotnet plugin. Useful in environments where .NET SDK is not available. |
NX_GRADLE_DISABLE | boolean | If set to true, disables the @nx/gradle plugin. Useful in environments where Java/Gradle is not available. |
NX_GRADLE_PROJECT_GRAPH_TIMEOUT | number | Timeout 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_DISABLE | boolean | If 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.
| Property | Type | Description |
|---|---|---|
NX_TASK_TARGET_PROJECT | string | Set to the project name of the task being run. Use this to tell which project is being run. |
NX_TASK_TARGET_TARGET | string | Set to the target name of the task being run. Use this to tell which target of the project is being run. |
NX_TASK_TARGET_CONFIGURATION | string | Set to the configuration name of the task being run. Use this to tell which configuration of the target is being run. |
NX_GRAPH_CREATION | boolean | Set 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_RUN | boolean | Set to true during dry runs of generators. Use this to avoid side effects during generators. |
NX_INTERACTIVE | boolean | Set to false when running generators with --interactive=false. Use this to prevent prompting during generators |
NX_RUNNING_NX_IMPORT | boolean | Set 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_INIT | boolean | Set to true while the nx init command is executing. Use this to have plugin code or scripts behave differently during workspace initialization. |
Nx Cloud environment variables
Section titled “Nx Cloud environment variables”The following environment variables are specific to Nx Cloud and can be used to configure cloud-specific behavior:
| Property | Type | Description |
|---|---|---|
NX_BRANCH | string | The 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_COLLECTION | boolean | Disables 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_DIRECTORY | string | Directory where Nx writes resource metrics during task execution. See Task Resource Usage. |
NX_CI_EXECUTION_ID | string | A 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_ENV | string | Used 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_TEMPLATE | string | Should 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_TOKEN | string | Configure 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_API | string | The URL of the Nx Cloud instance to connect to. Overrides nxCloudUrl in nx.json. |
NX_CLOUD_ENCRYPTION_KEY | string | Enable 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_TIMEOUTS | boolean | Disables the default 10-second timeout for Nx Cloud requests. |
NX_NO_OUTPUT_TIMEOUT | string | Overrides the launch template's no-output-timeout for an Nx Agent step. Duration string (e.g., 10m, 1h); "0" disables. |
NX_NO_CLOUD | boolean | If 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_LOGGING | boolean | Outputs debug information about agents communicating with the main job. Useful for debugging cache misses and on-premises setup issues. |
NX_WORKING_DIRECTORY | string | The 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_REVALIDATE | boolean | If 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_MS | number | Timeout in milliseconds an agent waits to hear from Nx Cloud before erroring. Defaults to 3600000 (60 minutes). |
NX_CLOUD_ORCHESTRATOR_TIMEOUT_MS | number | Timeout in milliseconds the orchestrator (main job) waits for a completed task response from Nx Cloud. Defaults to 3600000 (60 minutes). |
NX_CLOUD_NUMBER_OF_RETRIES | number | How many times Nx Cloud retries HTTP requests that fail with a transient error. Defaults to 10 on CI and 0 locally. |
NX_CLOUD_DISTRIBUTED_EXECUTION | boolean | Typically not needed. When set to false, disables distributed task execution. Prefer the --no-dte or --no-agents flags. |
Deprecated Nx Cloud environment variables
Section titled “Deprecated Nx Cloud environment variables”| Property | Type | Description |
|---|---|---|
NX_RUN_GROUP | string | Older 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_FAILURE | boolean | When 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_TOKEN | string | No longer needed. Use NX_CLOUD_ACCESS_TOKEN instead. Still read for backwards compatibility. |
NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT | number | No longer needed. Nx Cloud now derives the agent count from the launch template and workspace configuration automatically. |