Safe to Delete

Nx Monorepo Local Computation Cache (.nx/cache)

Quick Answer: Nx monorepo tool caches task execution outputs in .nx/cache. Learn how to safely reset and clear local Nx computation cache.

Bottom Line: It is 100% safe to clear .nx/cache. Nx uses local computation caching to skip previously executed build and test tasks. Wiping the cache simply forces Nx to re-execute tasks.


Why Does Nx Workspace Cache Exist?

Nx monorepos utilize computation caching to accelerate CI pipelines and local developer builds. When you run nx build my-app or nx test my-app, Nx hashes your source files, dependencies, and environment flags.

  • Primary Purpose: Skipping redundant builds, lints, and unit tests across monorepo packages.
  • Storage Impact: Large monorepos with dozens of projects accumulate gigabytes of cached build artifacts inside .nx/cache, consuming 2 GB to 20 GB+.
  • Location: Stored locally in <workspace-root>/.nx/cache or node_modules/.cache/nx.

What Happens If You Clear Nx Cache?

  • System Safety:100% Safe to Delete. No source code or git history is lost.
  • Build Impact: Subsequent Nx commands will execute all tasks fresh rather than pulling cached task outputs.
  • Reclaimed Storage: Reclaims 2 GB to 20 GB+ of local SSD storage.

How to Clear Nx Cache Safely

Method 1: Using Official Nx CLI Command

npx nx reset

Method 2: Manual Terminal Deletion

rm -rf .nx/cache node_modules/.cache/nx

Frequently Asked Questions (FAQ)

What does npx nx reset do?

npx nx reset stops running Nx daemon background processes and deletes the local .nx/cache directory.

Does clearing local Nx cache affect Nx Cloud remote cache?

No. Clearing local .nx/cache only deletes local disk task outputs. Remote caches stored on Nx Cloud remain accessible.

Discussion

Loading authentication...

Related in developer

The AI Engineer's Model Disk Cleanup Guide: Hugging Face, Ollama & PyTorch

The ultimate 1,200-word field guide for AI developers and local LLM hobbyists to reclaim 200GB+ from Ollama, Hugging Face, PyTorch, and vLLM model weights.

Safe to Delete

Android Studio System Index Cache (AndroidStudio Cache)

Android Studio caches Gradle project indexes, VFS caches, and compiler artifacts. Invalidate and clear is safe.

Safe to Delete

Ansible Automation Temp & Fact Cache (~/.ansible/tmp)

Ansible stores temporary playbook execution modules and target host fact JSON caches in ~/.ansible/tmp. Clearing Ansible tmp is safe.

Safe to Delete
Back to all files