查看自己有多少个node_modules

为了能够看看自己有多少个node_modules
可以首先进入有很多项目的目录

  1. cd workplace

在linux中

  1. find . -name "node_modules" -type d -prune | xargs du -chs

在windows中

  1. FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"

删除目录中所有找到的node_modules

警告!这个步骤会删除所有名字为node_modules 的文件夹

进入目录

  1. cd workplace

linux中删除

  1. find . -name "node_modules" -type d -prune -exec rm -rf '{}' +

windows中

  1. FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"

按以上步骤,我电脑弄出来将近20G的空间,没了累赘,项目移动起来也方便了!