Getting Started
Requirements
Section titled “Requirements”Knip v6 requires at least Node.js v20.19.0. Or Bun.
Installation
Section titled “Installation”The easiest and recommended way to install Knip:
npm init @knip/configpnpm create @knip/configbun create @knip/configyarn create @knip/configNow you can run Knip to lint your project:
npm run knippnpm knipbun knipyarn knipKnip will lint your project and report unused dependencies, exports and files.
The next step is to learn more about how Knip works or go straight to your first cleanup.
Coding agents
Section titled “Coding agents”Let your coding agent configure Knip using the Knip MCP Server. Paste this into your agent session:
Install the Knip MCP Server (@knip/mcp) and use it to configure Knip in this project.You may need to restart the session to pick up the new MCP server. Paste the prompt again and off you go.
Want to use Knip directly in your IDE? The Knip Editor Extension has the same MCP Server built in.
Manual
Section titled “Manual”Alternatively, manually install Knip using your package manager:
npm install -D knip typescript @types/nodepnpm add -D knip typescript @types/nodebun add -D knip typescript @types/nodeyarn add -D knip typescript @types/nodeKnip uses typescript and @types/node as peer dependencies to increase
compatibility with your project. No worries, they’re probably in your
node_modules already.
Then add a knip script to your package.json:
{ "name": "my-project", "scripts": { "knip": "knip" }}Without installation
Section titled “Without installation”To run Knip without adding it to your project:
npx knippnpm dlx knipbunx knipISC License © 2026Lars Kappert