[FEATURE] Visibility and a safe cleanup path for npm cache growth caused by frequent auto-updates (npm global install)

Status Open
Reported on v2.1.300
Maintainer reply None cached
Activity 0 comments · opened Oct 15, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Summary

With the npm global installation of Claude Code and auto-updates enabled, every new version leaves its package tarballs in the npm cache (~/.npm/_cacache). npm documents that its cache grows as new packages are installed and is not pruned automatically, so this is not a bug report against npm's behavior. However, because Claude Code updates very frequently and recent Linux binary packages are about 100–120 MB each, the cache grows steadily on long-running machines. We would like a way to see and safely manage the Claude Code–related portion of that cache.

Environment

  • OS: Ubuntu 24.04.5 LTS (x86_64)
  • Node.js v22.22.1 (via nvm), npm 10.9.4
  • Installation: npm install -g @anthropic-ai/claude-code (currently 2.1.300), auto-updates enabled
  • Usage: a server running long-lived sessions

Measurements (read-only, taken 2026-10-15)

Measured by reading the npm cache index (~/.npm/_cacache/index-v5); nothing was deleted, and npm cache verify was not run. Sizes are the byte counts recorded in the index; GB here means 10^9 bytes.

  • Total size recorded in the npm cache index: 5.94 GB
  • Of that, Claude Code–related tarballs: 5.83 GB (about 98%)
  • 56 versions are retained, each stored as two entries: the small @anthropic-ai/claude-code wrapper package and the platform package @anthropic-ai/claude-code-linux-x64 (about 100–120 MB each in recent versions). 112 entries in total, with no duplicated content.
  • Period covered: 2026-08-16 to 2026-10-15 (about 60 days). Averaged over that period, roughly one version per day, i.e. about 100 MB per day.
  • Examples of recent entries: 2.1.286 (Oct 1, 108.2 MB), 2.1.293 (Oct 8, 113.1 MB), 2.1.299 (Oct 14, 118.8 MB), 2.1.300 (Oct 15, 119.5 MB).

During the observation period, cached tarballs accumulated across updates; restarting Claude Code sessions did not reclaim that space.

Proposed Solution

Request

Any of the following would help:

  1. Visibility: a way to show how much disk space Claude Code's own packages occupy in the package-manager cache (for example in claude doctor or a similar command).
  2. A safe cleanup path: a command or option that removes cached tarballs of Claude Code versions older than the installed one, without touching other npm packages' cache entries.
  3. Or official guidance: documented, recommended steps for keeping this cache in check on machines that auto-update, so users don't have to resort to clearing the entire npm cache.

Alternative Solutions

Related

  • #6092 — the same per-version accumulation pattern, but in Bun's global cache (~/.bun/install/cache). Closed as not planned (auto-closed after inactivity).
  • #11646 — proposal for a claude clean command for ~/.claude caches and logs. It does not cover the npm cache. Closed as not planned (auto-closed after inactivity).

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗