npm cache

随着npm更新至v5.3.0版本,其缓存策略发生了显著变化。新增了npmcacheadd用于显式添加数据到本地缓存;npmcacheclean--force则用于强制清除所有缓存数据;npmcacheverify负责验证缓存内容的有效性并进行垃圾回收。这些命令的使用有助于提高npm的运行效率。

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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值