Known Issues
Known limitations and workarounds for errors during a Knip run.
See handling issues to learn more about dealing with lint issues.
Exceptions from config files
Section titled “Exceptions from config files”Knip plugins may fail to load a JavaScript or TypeScript configuration file such
as webpack.config.js or vite.config.ts:
$ knipERROR: Error loading vite.config.tsKnip exits with code 2 when a plugin config file fails to load.
--no-exit-code does not suppress this error.
Knip may load such files differently, in a different environment, with missing
environment variables, missing path aliases, etcetera. Use --debug to locate
the cause of the issue with more details.
Potential workarounds:
- For “Cannot find module” and “ENOENT: no such file/dir, open ‘./file’” errors:
- Install dependencies
- Use absolute paths, e.g. with
path.join()orpath.resolve() - Set path aliases
- Set missing environment variable(s), potential solutions:
- Use a helper package like dotenvx
KEY=VAL knipnode --env-file .env $(which knip)
- Run the build script to generate required files.
- Disable loading the file by overriding the default
configfor that plugin.- Example:
vite: { config: [] } - In a monorepo, be more specific like so:
workspaces: { "packages/lib": { vite: { config: [] } } } - If this helps, add the file as an
entryfile for static analysis.
- Example:
- Disable the related plugin.
- Example:
eslint: false - In a monorepo, be more specific like so:
workspaces: { "packages/lib": { eslint: false } } - If this helps, add the file as an
entryfile for static analysis.
- Example:
- As a last resort, ignore the workspace:
ignoreWorkspaces: ["packages/lib"].
Path aliases in config files
Section titled “Path aliases in config files”Loading the configuration file (e.g. cypress.config.ts) for one of Knip’s
plugins may give an error:
$ knipAnalyzing workspace ....Error loading .../cypress.config.tsReason: Cannot find module '@alias/name'Require stack:- .../cypress.config.tsSome tools (such as Cypress and Jest) support using TypeScript path aliases in the configuration file.
Potential workarounds:
- Rewrite the import in the configuration file to a relative import.
- Inject support with a module like
tsx:NODE_OPTIONS="--import tsx" knip - Or
tsconfig-paths:NODE_OPTIONS="--import tsconfig-paths/register.js" knip - Use Bun with knip-bun.
- See exceptions from config files for more potential workarounds.
Nx Daemon
Section titled “Nx Daemon”In Nx projects you might encounter this error:
NX Daemon process terminated and closed the connectionThe solution is to disable the Nx Daemon:
NX_DAEMON=false knipRaw transfer memory errors
Section titled “Raw transfer memory errors”On machines with low RAM or Windows with Node.js >=22, oxc-parser raw transfer may fail under memory pressure:
RangeError: Array buffer allocation failedDisable raw transfer to use the normal parser path:
KNIP_DISABLE_RAW_TRANSFER=1 knipStale cache results
Section titled “Stale cache results”With --cache, configuration or path alias changes may leave results stale. An
import may still be reported as unresolved after the missing file is added.
Newly added .gitignore files are also not detected automatically.
Run without --cache for fresh results, or delete the cache directory
(node_modules/.cache/knip by default, configurable with --cache-location)
before running with --cache again.
ISC License © 2026Lars Kappert