来自 Chris Ferdinandi 的不错 技巧
我的
node_modules
目录包含 50 MB 的小文件,在某些情况下包含超过 200 MB 的文件。 对于几十个项目来说,这真的加起来!
二十多个项目,每个项目包含 200 MB 的 node_modules
? 对于一堆你可能已经忘记了的东西来说,这将近 5 GB 的空间,这些东西什么也不做,如果你需要它们,只需一个命令就可以恢复。 我感觉应该有一个专门清理这些文件夹的应用程序,如果几周内没有使用它们就删除它们。
彻底清除它们
# Mac/Linux
find . -name "node_modules" -type d -prune -print | xargs du -chs
# Windows
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"