JavaScript storage guide

Find unused node_modules without deleting active work.

Dependency trees are often rebuildable, but “large” does not mean “unused.” Use project activity, package-manager identity, and lockfiles to decide which folders can leave the disk.

Look at the projectA folder’s age matters only in the context of its repository.
Keep manifestspackage.json and lockfiles describe what to restore.
Expect downloadsReinstallation costs time, bandwidth, and possibly build steps.

Why node_modules grows so quickly

Each JavaScript project can keep its own dependency tree. Monorepos, multiple package managers, native modules, and abandoned experiments can multiply the same packages across many directories. The correct cleanup target is the generated node_modules directory—not the surrounding repository.

How to judge whether a folder is inactive

  1. Confirm the parent contains a recognizable project manifest.
  2. Check recent activity across the project, not only the dependency folder’s modified date.
  3. Verify which package manager created the install by looking for package-lock.json, pnpm-lock.yaml, yarn.lock, or project configuration.
  4. Keep source files, manifests, lockfiles, patches, and package-manager configuration.
  5. Do not remove dependencies while a development server, build, test, or editor task is using them.
Important: reinstall scripts can execute project or dependency code. Restore dependencies using the project’s documented package-manager command and review unfamiliar repositories before running scripts.

What restoration looks like

For npm projects with a matching committed lockfile, npm ci performs a clean install and does not rewrite package.json or the lockfile. npm documents that it requires the lockfile and exits if the manifest and lockfile disagree. Other package managers have their own frozen or immutable install modes; use the command expected by that repository.

SpaceLint scans only project folders you explicitly add. It stops at recognized generated directories, uses an inactivity threshold, and never selects the project root or source tree as a cleanup candidate.

Official references

Find inactive dependencies by project context.

SpaceLint reports the exact generated directory, size, activity evidence, and restore impact before cleanup.