npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nodem-clean

v1.2.1

Published

删除指定目录下的所有 node_modules 文件夹

Readme

nodem-clean

一个用于递归删除指定目录下所有 node_modules 文件夹的命令行工具

npm version npm downloads license

简介

随着项目越来越多,散落在各处的 node_modules 会悄悄占用大量磁盘空间,手动一个个查找删除既繁琐又容易出错。nodem-clean 可以递归扫描指定目录,一次性清理掉其中所有的 node_modules 文件夹,帮你快速释放磁盘空间。

特性

  • 🔍 递归扫描指定目录下的所有 node_modules
  • 📂 支持指定任意路径,默认清理当前目录
  • 🔒 自动跳过符号链接(symlink),避免跨目录误删
  • 🛡️ 禁止直接扫描根目录(如 /C:\),降低高风险误操作
  • ⚡ 基于 TypeScript 开发,使用简单

安装

全局安装:

# npm
npm install -g nodem-clean

# pnpm
pnpm add -g nodem-clean

# yarn
yarn global add nodem-clean

或者无需安装,直接通过 npx 运行:

npx nodem-clean k

快速开始

清理当前目录下的所有 node_modules

nodem-clean k

使用

命令结构:

nodem-clean <command> [options]

常用示例:

# 删除当前目录下的 node_modules(. 表示当前目录)
nodem-clean killer .

# 简写:不加路径默认为当前目录
nodem-clean k

# 指定路径
nodem-clean k --path D:projectstest

# 指定路径(简写)
nodem-clean k -p D:projectstest

命令与参数

| 命令 / 参数 | 简写 | 说明 | 默认值 | | ---------------- | ---- | ----------------- | ----------- | | killer | k | 执行删除操作 | — | | --path <dir> | -p | 指定要扫描的目录 | 当前目录 . |

提示:killerk 完全等价;不传路径或传 . 都表示当前目录。

行为说明

  • 为避免跨目录误删,工具默认跳过符号链接(symlink)及其指向内容。
  • 为避免高风险误操作,工具不允许直接扫描根目录(例如 /C:\)。

常见问题(FAQ)

删除后还能恢复吗? 不能。node_modules 会被直接删除,请确认目录无误后再执行。

删除后如何恢复依赖? 进入对应项目目录重新执行 npm install / pnpm install / yarn 即可。

开发

pnpm install
pnpm run typecheck
pnpm run build

本地调试可使用 npm link 将命令链接到全局后进行测试。

贡献

欢迎提交 Issue 和 Pull Request。如有功能建议或 Bug 反馈,请前往 Issues 页面。

许可证

MIT