Registry / devops / vite-plugin-killer-instincts

vite-plugin-killer-instincts

JSON →
library1.1.0jsnpmunverified

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.

npm install vite-plugin-killer-instincts
INSTALL
IMPORT
SIG · VITE-PLUGIN-KILLER
V
vite-plugin-killer-instincts
devopsjavascriptv1.1.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import killerInstincts from 'vite-plugin-killer-instincts'
✗ import { killerInstincts } from 'vite-plugin-killer-instincts'
This package exports a default function, not a named export.
killerInstincts (default import in CommonJS)
✓ const killerInstincts = require('vite-plugin-killer-instincts')
✗ const { killerInstincts } = require('vite-plugin-killer-instincts')
CJS require returns the default export directly.
default import with type assertion (TypeScript users)
✓ import killerInstincts from 'vite-plugin-killer-instincts'
✗ import killerInstincts = require('vite-plugin-killer-instincts')
Use ESM import syntax; the package ships TypeScript types.

Configure Vite to use the plugin with strictPort and autoKill enabled.

// vite.config.ts import { defineConfig } from 'vite'; import killerInstincts from 'vite-plugin-killer-instincts'; export default defineConfig({ server: { port: 3000, strictPort: true, }, plugins: [ killerInstincts({ autoKill: true, // kills the blocking process automatically }), ], });
Debug
Known issues
gotchaThe plugin only activates when `strictPort: true` is set in the Vite server config.
fix
Ensure you have `server.strictPort: true` in your Vite config.
affects: >=1.0.0
gotchaWhen `autoKill` is false (default), the plugin throws an error with instructions; it does not attempt to kill the process.
fix
Set `autoKill: true` if you want automatic process termination. Otherwise, manually run the suggested kill command.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Port 3000 is already in use. Could not automatically kill process. Run `kill -9 PID` to manually kill the process.
autoKill is set to false and port is occupied.
fix
Set `autoKill: true` in plugin options, or run the displayed `kill -9 PID` command.
[vite] Internal server error: killerInstincts is not a function
User tried to use a named import `{ killerInstincts }` instead of default import.
fix
Use `import killerInstincts from 'vite-plugin-killer-instincts'` (default import).
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
viterequiredpeer dependency, required for plugin API
Agent activity
22 hits · last 30 days
node
20
Resources
vite-plugin-killer-instincts — npm install vite-plugin-killer-instincts · libregistry