node.js - 有没有办法在不从本地驱动器打开每个项目的情况下删除所有 node_module?

标签 node.js windows npm command node-modules

我有多个使用 node_modules 的项目,我一个月都没有碰过。 如果我只能删除 node_module 可以节省我的 5 到 8 GB 存储空间。

我找到了 Command line tool to delete folder with a specified name recursively in Windows 但这显示删除特定文件夹中的文件,如

D:\Project\Doing\prject1\
D:\Project\Complete\Project1\

FOR /d /r . %d IN (project1) DO @IF EXIST "%d" rd /s /q "%d"

But i don't want to search every directory to look for node_module instead i want to delete all the node_module folder from my PC (all the drive) how can i do that?

如果我需要返回 node_modules,我可以简单地运行 npm install,所以清理空间对我来说是个好主意。

最佳答案

我找到了解决方案 here这就像一个魅力。

找到 . -name "node_modules"-exec rm -rf '{}' +

关于node.js - 有没有办法在不从本地驱动器打开每个项目的情况下删除所有 node_module?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51626997/

相关文章:

c++ - 在 C++ 中使用 Node.js 创建 TCP 连接

c - 如何在 C 中检查 Windows 中是否启用了防火墙

ember.js - 将 Ember 应用程序从 bower 迁移到 npm

node.js - 如何使用 Node tmp 包从缓冲区写入文件

node.js - MongoDB、Mongoose 从一个 Find 中搜索另一个集合的结果

windows - 'slc' 不是内部或外部命令,也不是可运行的程序或批处理文件

windows - Windows 的 Docker 桌面在使用公司代理进行搜索/构建时失败

javascript - 如何以编程方式为询问者的答案设置选定值

docker - Docker镜像有效,Kubernetes Pod不起作用。 Ubuntu的。日志:/bin/sh:[npm,开始]:未找到

javascript - 获取 POST ReactJs 到 Controller .Net Core