npm 升到最新版本v5.3.0,刚安装webpack出现莫名的错误,清下npm缓存 npm cache clean,竟然报错。提示是npm@5版本清理缓存加 --force
或npm cache verify . 原来前段时间npm@5版本发布,最大的改进之处就是对npm缓存策略的变动。
npm 是包管理器,它对于cache提供了3个命令:
npm cache add:
add the specified package to the local cache. This command is primarily intended to be used internally
by npm, but it can provide a way to add data to the local installation cache explicitly.
npm cache clean --force:
delete all data out of the cache folder.
npm cache verify:
verify the contents of the cache folder,
garbage collecting any unneeded data, and verifying the integrity of the cache index and all cached data.
verify和clean --force的区别在于是否会验证缓存数据的有效性和完整性从而进行有效cache clean.
随着npm更新至v5.3.0版本,其缓存策略发生了显著变化。新增了npmcacheadd用于显式添加数据到本地缓存;npmcacheclean--force则用于强制清除所有缓存数据;npmcacheverify负责验证缓存内容的有效性并进行垃圾回收。这些命令的使用有助于提高npm的运行效率。

7662

被折叠的 条评论
为什么被折叠?



