Skip to main content
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.
boolean
Re-run tasks even when cached results are available. Equivalent to passing --skip-nx-cache on the command line.
boolean
Alias for NX_SKIP_NX_CACHE.
string
Override the local task output cache directory. Defaults to .nx/cache. Equivalent to cacheDirectory in nx.json.
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.
string
Override the directory used for the project graph cache and other internal Nx caches. Defaults to .nx/workspace-data.
boolean
Disable all remote caching. The remote cache (Nx Cloud or self-hosted) will not be read from or written to.
boolean
Alias for NX_SKIP_REMOTE_CACHE.
boolean
Set to false to disable the project graph cache. Useful when developing a plugin that modifies the project graph.
number
Number of tasks to run in parallel. Overrides parallel in nx.json and the --parallel flag.
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.
string
Deprecated alias for NX_TASKS_RUNNER.
boolean
Set to true to ignore circular dependency errors in the task graph. Equivalent to --nxIgnoreCycles.
boolean
Run tasks in batches for executors that support batch execution.
string
The project used when no project is specified, e.g. bare nx build. Overrides defaultProject in nx.json.
string
The base git ref used by nx affected to compute changed projects. Overrides defaultBase in nx.json and --base on the command line.
string
The head git ref used by nx affected. Overrides --head on the command line.
boolean
default:"true"
Set to false to prevent Nx from adding inference plugins when generating new projects.
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.
boolean
Print debug information useful for troubleshooting task execution and configuration issues.
boolean
Print performance profiling information for executors and Nx internals.
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.
string
Default output style when running tasks. Overrides --outputStyle.
boolean
Set to false to use the non-dynamic (CI-style) output even in terminals that support dynamic output.
boolean
Set to true to prevent Nx from grouping task logs on CI.
boolean
Enable (true) or disable (false) the interactive Terminal UI. Overrides tui.enabled in nx.json.
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.
boolean
Perform a dry run of a generator — no files are created and no packages are installed.
boolean
Allow Nx to prompt for additional input when running generators.
boolean
Suppress file operation logs during nx generate.
boolean
Skip Prettier formatting in generators and migrations. Useful when using an alternative formatter such as Biome or dprint.
boolean
Prevent nx migrate --run-migrations from automatically installing packages.
boolean
Use the locally installed nx version instead of downloading the latest when running nx migrate.
string
The version of Nx to use for nx migrate. Defaults to "latest".
boolean
Skip fetching package metadata from the registry during migration.
boolean
Set to false to prevent Nx from loading .env, .local.env, and .env.local files.
boolean
Use the locally installed Nx version instead of downloading the latest for commands such as nx init and nx migrate.
boolean
Force Nx to use ts-node to execute TypeScript plugin files, even when @swc-node/register is installed.
boolean
Use Node.js native TypeScript type stripping (Node.js 22.6+) instead of @swc-node/register or ts-node. Improves startup performance.
string
Override the directory where native .node binary files are cached. Interpreted as an absolute path.
boolean
Sort TypeScript path mappings in the root tsconfig file when generators run.
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.

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).

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.
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.
string
URL of the Nx Cloud instance. Overrides nxCloudUrl in nx.json. Use for self-hosted Nx Cloud deployments.
string
Encryption key for end-to-end encryption of cached artifacts. Also configurable via nxCloudEncryptionKey in nx.json.
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.
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.
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.
string
Distinguishes multiple main jobs (e.g. Linux vs Windows). Agents with a matching value will be assigned tasks from the corresponding main job.
string
Subdirectory containing the Nx workspace, when the workspace is not at the repository root. Only used by Nx Agents.
string
Attaches a launch template type to agents for Manual DTE assignment rules.
boolean
Disable collection of CPU and memory metrics during task execution. Metrics are enabled by default for enterprise users on Nx 22.1+.
string
Directory where Nx writes resource usage metrics during task execution.
boolean
Disable the default 10-second timeout for Nx Cloud requests.

Deprecated Nx Cloud variables

These variables are deprecated. Migrate to the recommended alternatives.