NPM 管理缓存
当你通过 npm 安装一个模块时,它会保存一份模块的副本,所以当你下次安装同样的模块的时候,npm 它不会访问网络,而是直接从你当前工作目录的 .npm 文件夹下读取缓存。
$ ls ~/.npm anonymous-cli-metrics.json _cacache _locks npm registry.npmjs.org
但是随着时间的推移,你的 .npm 文件夹会有很多夹杂许多旧的模块包,这时就很有必要定期清理一下你的 .npm 目录了。
`$ npm cache clean`
如果你的想清除你系统内有多个 node 工程,你也在你的工作目录下使用以下命令删除所有的 node_modules 文件夹。
`find . -name "node_modules" -type d -exec rm -rf '{}' +`