v1.0 - Because the problem is modern development.2026-11-12
<img width="1920" height="1080" alt="npkill 1.0.0 cover" src="https://github.com/user-attachments/assets/0b74b76b-ac8d-4695-9bdb-8fac2ec32d8d" />
npkill started in 2019 as a small script to hunt nodemodules. Six years later, nodemodules is only part of what piles up on a dev machine. Every framework and language leaves its own build outputs and caches behind.
If you don't want to change anything, you don't have to. npx npkill works as always, it just finds a lot more.
You can read all the details of this update in this post or watch the teaser (1:15).
Added
- Added profiles: sets of targets that represent a development ecosystem. The default one is node, which finds node_modules and also .next, .nuxt, .angular, .turbo and friends. There are 20 built-in profiles (python, rust, java, dotnet, unity...). Use them with --profiles node,python or list them with --profiles. More info.
- Added smart targets: some folders are only shown when the files around them confirm what they are. For example, target only appears next to a Cargo.toml or pom.xml.
- Added .npkillrc: define your default options and your own profiles. npkill looks for ./.npkillrc first and then for ~/.npkillrc. You can also use --config. More info.
- Added panels: navigate with ← and → between Help, Options, the results and Info.
- Help: quick reference with all the shortcuts.
- Options: change the sort, the targets or the directory without restarting npkill.
- Info: details of the result under the cursor, like the exact date of the last change or the risk of deleting it.
- Added multi-select mode: press t to select several results and delete them at once. Use v to select a range and a to select all.
- Added search: press / to filter the results by name or path. It supports regex.
- Added JSON output: --json prints all the results as a single object and --json-stream prints one result per line as they are found. Both can delete without the interface with --delete-all -y. More info.
- Added API: the core is now separated from the cli, so you can use npkill from your own code with import { Npkill } from 'npkill'. More info.
- Added multiple targets: --targets node_modules,.cache.
- Added --older-than: only show results whose project has not been modified in the given number of days (#271, thanks @Shreyakb301).
- Added --no-size, --no-age and --no-stats to skip the calculations you don't need (#246, #250, thanks @yetanotheraryan and @StanislavKozachenko).
- Added --size-unit (auto, mb, gb). With auto the unit changes between MB and GB by itself.
- Added --no-ignore-default to also look inside the folders that npkill skips by default, like .git or .nvm.
- Added scrollbar to the results. Yes, it didn't have one. I'd rather not talk about it.
- Added results counter and the active profiles in the header.
Changed
- ❗ Changed --target to --targets.
- ❗ Changed --exclude-hidden-directories to --exclude-sensitive. -x no longer hides the "dot" directories, it hides the results marked as sensitive.
- ❗ Changed --delete-all: now it requires --targets. Nothing is deleted automatically unless you say exactly what.
- ❗ Changed --sort last-mod to --sort age. The Last_mod column is now Age.
- ❗ Changed -gb to --size-unit gb.
- ❗ Removed --bg-color.
- ❗ Unknown options are now rejected instead of ignored.
- Changed --exclude: now it accepts patterns. A name matches anywhere, ./path matches from the scan root and **/path matches at any depth (#269, thanks @Ludvins and @NyaGarcia).
- Changed search engine: workers now share memory. Up to 3x faster searches (#281).
- Changed size calculation: it now runs in the workers and no longer follows symlinks.
- Symlinks are now skipped during the search.
- Improved the detection of sensitive results.
- Improved --help output.
- Improved the "no results" message and the Size and Age loading indicators.
- Simplified the header. Columns now adapt to the terminal width.
- Replaced colors with picocolors and removed unused dependencies.
- Update dependencies.
Fixed
- Fixed npkill not starting in non-TTY environments.
- Fixed results flickering when two of them have the same value on sort.
- Fixed stats going back to their default value when resizing or changing panel.
- Fixed npkill not working on Android (#275, thanks @kukirin-ui).
- Fixed the search hanging when the scan fails. Now it exits with the reason.
- Fixed typo in the exit text (#189, thanks @zaaakher).
***
Thanks to everyone who reported bugs and shared ideas during all these years. npkill wouldn't be what it is without you.
npx npkill@latest and share your results!
https://github.com/voidcosmos/npkill/compare/v0.12.2...v1.0.0
v0.12.22024-06-08
修复了 Windows 系统下影响界面显示的若干问题(#183)。此前在 Windows 环境中使用时,UI 可能出现布局错乱、显示异常等情况,本次更新予以处理,Windows 用户升级后界面表现将恢复正常。
v0.12.12024-05-31
v0.12.1 是一个补丁版本,只处理了一处报错:此前在 Windows 下删除文件夹时会抛出「Cannot read windowsStrategyManager of undefined」,删除操作直接中断,非 Windows 平台不受影响。本次修正了 Windows 平台策略管理器的取值时机,让删除流程能够正常跑完。功能上没有其他变化,Windows 用户建议直接升到这一版。
v0.12.02024-05-30
npkill 0.12.0 更新介绍
这版主要提升删除操作的可控性与反馈。新增 --dry-run 模式,可先预览将被清理的目录而不实际执行;配合已启用的 --delete-all 参数,能一键删掉全部搜索结果,省去逐条确认。删除过程中新增「Pending tasks」面板,实时列出正在清理的目录,配合「Releasable space」「Space saved」数值变化时的视觉提示,进度一目了然。另外补上 o 快捷键,直接在资源管理器中打开项目目录。
界面方面,状态信息上移一行,黄色标题栏改为通栏绘制,部分文案做了大小写规范与微调,依赖也同步升级。
v0.11.32023-04-21
npkill v0.11.3:修复了 Windows 环境下偶发的崩溃问题,报错信息为 "cannot read message of undefined (err)";同时修正了宽终端中帮助信息显示错乱的情况。交互方面新增了 DEL 键,选中条目后可直接删除对应结果,省去了多一步的操作。
v0.11.22023-04-11
npkill v0.11.2 修复了一个比较尴尬的崩溃:当扫描到的某个目录体积超过 999.99MB 时,程序会直接挂掉(#149)。原因是超大数字在格式化时溢出,这次除了修掉崩溃,还顺手统一了显示规则——超过 999.99MB 的结果只保留一位小数,避免数字撑破界面。
日志方面也做了简化:以前会按日期不断生成新日志文件,越攒越多,现在只保留 npkill-latest.log 和 npkill-old.log 两个文件,新的覆盖旧的,磁盘占用可控,排查问题时翻起来也省事。
此外对代码库做了一轮重构,内部结构更清晰,对外使用方式没有变化。如果你之前遇到过扫描大目录时闪退的问题,升级到这个版本即可。
v0.11.1 - The Performance Update2023-03-24
npkill v0.11.1:搜索与界面双提速
这版主要围绕性能做文章。搜索改用 Workers Threads 实现,官方在 8 核机器上的测试提速约 70%,作者也欢迎用户反馈自己的数据;界面绘制优化幅度约 90%。其他改动:文件夹大小列改为右对齐,last_mod 无法计算时由 xxx 简化为 xx,错误弹窗标题也做了精简。
修复方面:--exclude 参数失效、搜索过程中结果闪烁、结果区域的若干视觉问题、滚动到底部多出空行,以及删除无结果项时误报警告。
v0.11.02023-03-05
npkill v0.11.0 更新:新增搜索进度条,让分析过程一目了然;搜索结束但仍在统计目录大小时,状态提示从"搜索中"改为"正在统计",更贴合实际。按 e 键可弹出错误汇总窗口,有错误时还会显示计数,退出时日志会写入系统临时目录。搜索引擎重构为基于 node 与 worker 的统一方案,跨平台效率更一致——不过官方也承认部分场景下速度可能反而变慢,后续会再优化。此外,黄色提示牌文案与位置做了精简调整;修复了错误堆在终端末尾造成的显示错乱,以及传入不存在的 --directory 参数时程序无限搜索的问题,现在会先校验目录的权限与类型。
v0.10.02022-11-11
npkill v0.10.0:结果新增 lastmod 列(#134),显示 nodemodules 所在工作区中最近一个文件的修改时间;配套增加 --sort last-mod,可按该列降序排列。搜索时会显示计时器,结束后展示本次搜索耗时;横幅旁现在会标出当前版本号。另外收窄了结果区左侧留白,信息密度更高。
v0.9.02022-10-21
这一版不兼容 Node 14 以下环境,升级前请先确认运行时版本。
新增快速滚动功能,用 PgUp、HOME 等键即可在结果列表中快速跳转,具体用法见 README;搜索无结果时会显示「No results found」提示,不再一片空白。另加了一个 --exclude-hidden-directories/-x 开关,可以把隐藏目录排除在搜索之外。
修复了 MaxListenersExceededWarnings 警告反复刷屏的问题。项目整体迁移到 ESM,命令行参数改为用 = 号赋值,依赖也一并更新。