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

# Environment variables

> Complete reference for all environment variables that configure Nx CLI behavior, caching, the daemon, Nx Cloud, and built-in plugins.

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

<Tip>
  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`.
</Tip>

## Core Nx variables

These variables affect the Nx CLI's core behavior: task execution, caching, and the project graph.

<AccordionGroup>
  <Accordion title="Caching">
    <ParamField body="NX_SKIP_NX_CACHE" type="boolean">
      Re-run tasks even when cached results are available. Equivalent to
      passing `--skip-nx-cache` on the command line.
    </ParamField>

    <ParamField body="NX_DISABLE_NX_CACHE" type="boolean">
      Alias for `NX_SKIP_NX_CACHE`.
    </ParamField>

    <ParamField body="NX_CACHE_DIRECTORY" type="string">
      Override the local task output cache directory. Defaults to `.nx/cache`.
      Equivalent to `cacheDirectory` in `nx.json`.
    </ParamField>

    <ParamField body="NX_MAX_CACHE_SIZE" type="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](/reference/nx-json) for supported units.
    </ParamField>

    <ParamField body="NX_WORKSPACE_DATA_DIRECTORY" type="string">
      Override the directory used for the project graph cache and other
      internal Nx caches. Defaults to `.nx/workspace-data`.
    </ParamField>

    <ParamField body="NX_SKIP_REMOTE_CACHE" type="boolean">
      Disable all remote caching. The remote cache (Nx Cloud or self-hosted)
      will not be read from or written to.
    </ParamField>

    <ParamField body="NX_DISABLE_REMOTE_CACHE" type="boolean">
      Alias for `NX_SKIP_REMOTE_CACHE`.
    </ParamField>

    <ParamField body="NX_CACHE_PROJECT_GRAPH" type="boolean">
      Set to `false` to disable the project graph cache. Useful when
      developing a plugin that modifies the project graph.
    </ParamField>
  </Accordion>

  <Accordion title="Task execution">
    <ParamField body="NX_PARALLEL" type="number">
      Number of tasks to run in parallel. Overrides `parallel` in `nx.json`
      and the `--parallel` flag.
    </ParamField>

    <ParamField body="NX_TASKS_RUNNER" type="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.
    </ParamField>

    <ParamField body="NX_RUNNER" type="string">
      Deprecated alias for `NX_TASKS_RUNNER`.
    </ParamField>

    <ParamField body="NX_IGNORE_CYCLES" type="boolean">
      Set to `true` to ignore circular dependency errors in the task graph.
      Equivalent to `--nxIgnoreCycles`.
    </ParamField>

    <ParamField body="NX_BATCH_MODE" type="boolean">
      Run tasks in batches for executors that support batch execution.
    </ParamField>
  </Accordion>

  <Accordion title="Project graph">
    <ParamField body="NX_DEFAULT_PROJECT" type="string">
      The project used when no project is specified, e.g. bare `nx build`.
      Overrides `defaultProject` in `nx.json`.
    </ParamField>

    <ParamField body="NX_BASE" type="string">
      The base git ref used by `nx affected` to compute changed projects.
      Overrides `defaultBase` in `nx.json` and `--base` on the command line.
    </ParamField>

    <ParamField body="NX_HEAD" type="string">
      The head git ref used by `nx affected`. Overrides `--head` on the
      command line.
    </ParamField>

    <ParamField body="NX_ADD_PLUGINS" type="boolean" default="true">
      Set to `false` to prevent Nx from adding inference plugins when
      generating new projects.
    </ParamField>
  </Accordion>

  <Accordion title="Daemon">
    <ParamField body="NX_DAEMON" type="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.
    </ParamField>
  </Accordion>

  <Accordion title="Output and logging">
    <ParamField body="NX_VERBOSE_LOGGING" type="boolean">
      Print debug information useful for troubleshooting task execution and
      configuration issues.
    </ParamField>

    <ParamField body="NX_PERF_LOGGING" type="boolean">
      Print performance profiling information for executors and Nx internals.
    </ParamField>

    <ParamField body="NX_PROFILE" type="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.
    </ParamField>

    <ParamField body="NX_DEFAULT_OUTPUT_STYLE" type="string">
      Default output style when running tasks. Overrides `--outputStyle`.
    </ParamField>

    <ParamField body="NX_TASKS_RUNNER_DYNAMIC_OUTPUT" type="boolean">
      Set to `false` to use the non-dynamic (CI-style) output even in
      terminals that support dynamic output.
    </ParamField>

    <ParamField body="NX_SKIP_LOG_GROUPING" type="boolean">
      Set to `true` to prevent Nx from grouping task logs on CI.
    </ParamField>
  </Accordion>

  <Accordion title="Terminal UI (TUI)">
    <ParamField body="NX_TUI" type="boolean">
      Enable (`true`) or disable (`false`) the interactive Terminal UI.
      Overrides `tui.enabled` in `nx.json`.
    </ParamField>

    <ParamField body="NX_TUI_AUTO_EXIT" type="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`.
    </ParamField>
  </Accordion>

  <Accordion title="Generators and migrations">
    <ParamField body="NX_DRY_RUN" type="boolean">
      Perform a dry run of a generator — no files are created and no packages
      are installed.
    </ParamField>

    <ParamField body="NX_INTERACTIVE" type="boolean">
      Allow Nx to prompt for additional input when running generators.
    </ParamField>

    <ParamField body="NX_GENERATE_QUIET" type="boolean">
      Suppress file operation logs during `nx generate`.
    </ParamField>

    <ParamField body="NX_SKIP_FORMAT" type="boolean">
      Skip Prettier formatting in generators and migrations. Useful when using
      an alternative formatter such as Biome or dprint.
    </ParamField>

    <ParamField body="NX_MIGRATE_SKIP_INSTALL" type="boolean">
      Prevent `nx migrate --run-migrations` from automatically installing
      packages.
    </ParamField>

    <ParamField body="NX_MIGRATE_USE_LOCAL" type="boolean">
      Use the locally installed `nx` version instead of downloading the latest
      when running `nx migrate`.
    </ParamField>

    <ParamField body="NX_MIGRATE_CLI_VERSION" type="string">
      The version of Nx to use for `nx migrate`. Defaults to `"latest"`.
    </ParamField>

    <ParamField body="NX_MIGRATE_SKIP_REGISTRY_FETCH" type="boolean">
      Skip fetching package metadata from the registry during migration.
    </ParamField>
  </Accordion>

  <Accordion title="Other">
    <ParamField body="NX_LOAD_DOT_ENV_FILES" type="boolean">
      Set to `false` to prevent Nx from loading `.env`, `.local.env`, and
      `.env.local` files.
    </ParamField>

    <ParamField body="NX_USE_LOCAL" type="boolean">
      Use the locally installed Nx version instead of downloading the latest
      for commands such as `nx init` and `nx migrate`.
    </ParamField>

    <ParamField body="NX_PREFER_TS_NODE" type="boolean">
      Force Nx to use `ts-node` to execute TypeScript plugin files, even when
      `@swc-node/register` is installed.
    </ParamField>

    <ParamField body="NX_PREFER_NODE_STRIP_TYPES" type="boolean">
      Use Node.js native TypeScript type stripping (Node.js 22.6+) instead of
      `@swc-node/register` or `ts-node`. Improves startup performance.
    </ParamField>

    <ParamField body="NX_NATIVE_FILE_CACHE_DIRECTORY" type="string">
      Override the directory where native `.node` binary files are cached.
      Interpreted as an absolute path.
    </ParamField>

    <ParamField body="NX_FORMAT_SORT_TSCONFIG_PATHS" type="boolean">
      Sort TypeScript path mappings in the root `tsconfig` file when generators
      run.
    </ParamField>

    <ParamField body="NX_PLUGIN_NO_TIMEOUTS" type="boolean">
      Disable timeouts for plugin operations.
    </ParamField>
  </Accordion>
</AccordionGroup>

## 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](https://nx.app) for remote caching and distributed task execution.

<Note>
  Nx Cloud also respects `NX_VERBOSE_LOGGING` to output debug information about
  agent communication and cache operations.
</Note>

<AccordionGroup>
  <Accordion title="Authentication and connection">
    <ParamField body="NX_CLOUD_ACCESS_TOKEN" type="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.
    </ParamField>

    <ParamField body="NX_CLOUD_API" type="string">
      URL of the Nx Cloud instance. Overrides `nxCloudUrl` in `nx.json`. Use
      for self-hosted Nx Cloud deployments.
    </ParamField>

    <ParamField body="NX_CLOUD_ENCRYPTION_KEY" type="string">
      Encryption key for end-to-end encryption of cached artifacts. Also
      configurable via `nxCloudEncryptionKey` in `nx.json`.
    </ParamField>

    <ParamField body="NX_NO_CLOUD" type="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.
    </ParamField>
  </Accordion>

  <Accordion title="CI integration">
    <ParamField body="NX_BRANCH" type="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.
    </ParamField>

    <ParamField body="NX_CI_EXECUTION_ID" type="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.
    </ParamField>

    <ParamField body="NX_CI_EXECUTION_ENV" type="string">
      Distinguishes multiple main jobs (e.g. Linux vs Windows). Agents with a
      matching value will be assigned tasks from the corresponding main job.
    </ParamField>

    <ParamField body="NX_WORKING_DIRECTORY" type="string">
      Subdirectory containing the Nx workspace, when the workspace is not at
      the repository root. Only used by Nx Agents.
    </ParamField>

    <ParamField body="NX_AGENT_LAUNCH_TEMPLATE" type="string">
      Attaches a launch template type to agents for Manual DTE assignment rules.
    </ParamField>
  </Accordion>

  <Accordion title="Metrics and diagnostics">
    <ParamField body="NX_CLOUD_DISABLE_METRICS_COLLECTION" type="boolean">
      Disable collection of CPU and memory metrics during task execution.
      Metrics are enabled by default for enterprise users on Nx 22.1+.
    </ParamField>

    <ParamField body="NX_CLOUD_METRICS_DIRECTORY" type="string">
      Directory where Nx writes resource usage metrics during task execution.
    </ParamField>

    <ParamField body="NX_CLOUD_NO_TIMEOUTS" type="boolean">
      Disable the default 10-second timeout for Nx Cloud requests.
    </ParamField>
  </Accordion>
</AccordionGroup>

### Deprecated Nx Cloud variables

<Warning>
  These variables are deprecated. Migrate to the recommended alternatives.
</Warning>

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