{"id":22712,"library":"vite-plugin-killer-instincts","title":"vite-plugin-killer-instincts","description":"A Vite plugin that detects when a process is already using the configured dev server port and optionally kills it. Version 1.1.0, works with Vite >=5.0.0. Key differentiator: integrates with Vite's `strictPort` to either throw a helpful error (default) or automatically terminate the blocking process (`autoKill: true`). Compatible with both ESM and CommonJS setups. Maintained by Wes Bos.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/wesbos/vite-plugin-killer-instincts","tags":["javascript","vite","vite-plugin","port","kill","strictPort","dev-server","typescript"],"install":[{"cmd":"npm install vite-plugin-killer-instincts","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-killer-instincts","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-killer-instincts","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, required for plugin API","package":"vite","optional":false}],"imports":[{"note":"This package exports a default function, not a named export.","wrong":"import { killerInstincts } from 'vite-plugin-killer-instincts'","symbol":"default","correct":"import killerInstincts from 'vite-plugin-killer-instincts'"},{"note":"CJS require returns the default export directly.","wrong":"const { killerInstincts } = require('vite-plugin-killer-instincts')","symbol":"killerInstincts (default import in CommonJS)","correct":"const killerInstincts = require('vite-plugin-killer-instincts')"},{"note":"Use ESM import syntax; the package ships TypeScript types.","wrong":"import killerInstincts = require('vite-plugin-killer-instincts')","symbol":"default import with type assertion (TypeScript users)","correct":"import killerInstincts from 'vite-plugin-killer-instincts'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport killerInstincts from 'vite-plugin-killer-instincts';\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n    strictPort: true,\n  },\n  plugins: [\n    killerInstincts({\n      autoKill: true, // kills the blocking process automatically\n    }),\n  ],\n});","lang":"typescript","description":"Configure Vite to use the plugin with strictPort and autoKill enabled."},"warnings":[{"fix":"Ensure you have `server.strictPort: true` in your Vite config.","message":"The plugin only activates when `strictPort: true` is set in the Vite server config.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set `autoKill: true` if you want automatic process termination. Otherwise, manually run the suggested kill command.","message":"When `autoKill` is false (default), the plugin throws an error with instructions; it does not attempt to kill the process.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Set `autoKill: true` in plugin options, or run the displayed `kill -9 PID` command.","cause":"autoKill is set to false and port is occupied.","error":"Error: Port 3000 is already in use. Could not automatically kill process.\n\nRun `kill -9 PID` to manually kill the process."},{"fix":"Use `import killerInstincts from 'vite-plugin-killer-instincts'` (default import).","cause":"User tried to use a named import `{ killerInstincts }` instead of default import.","error":"[vite] Internal server error: killerInstincts is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}