WindowsmacOSLinux

Where Does Knip Store Config and Cache?

Knip reads entry and project patterns from knip.json in the repo root, with a local cache inside node_modules.

Last updated

Knip aims for zero config, so many projects have no file at all and rely on the built-in entry defaults. When the project structure drifts from those defaults, a knip.json (or knip.ts, or the knip key in package.json) at the root sets entry and project globs straight.

Repeated runs get faster through a cache inside node_modules. It is conservative by design, which usually just works, but it is also the first suspect when results smell outdated.

Where Knip stores this, by platform

Windows
[RepoDir]\knip.json

Entry and project globs live here when defaults fall short. Alternatives: knip.jsonc, knip.ts, or the knip key in package.json. Override path with --config.

macOS
[RepoDir]/knip.json

Same candidates. Analysis cache sits in node_modules/.cache/knip; use --cache-location to move it or delete the folder to force a cold run.

Linux
[RepoDir]/knip.json

Same layout as macOS. The cache default is ./node_modules/.cache/knip relative to the working directory, so per-workspace runs keep separate caches.

Frequently asked questions

Knip reports stale results after I moved files. How do I fix it?

Delete node_modules/.cache/knip and rerun. The cache keys on mtime plus size, so restored or rebased files can look unchanged when they are not.

How do I use a Knip config outside the repo root?

Pass knip --config <path>. Otherwise Knip walks its fixed candidate list (knip.json, knip.ts, package.json knip key) and takes the first hit.

Notice an outdated path? Let us know.