Clear *just one* package from NPM cache

> npm cache ls [email protected]
make-fetch-happen:request-cache:https://registry.npmjs.org/vue/-/vue-2.6.12.tgz
make-fetch-happen:request-cache:https://registry.npmjs.org/vue
make-fetch-happen:request-cache:https://registry.npmjs.org/vue

all list item is the cache key, then clean the cache by key

> npm cache clean make-fetch-happen:request-cache:https://registry.npmjs.org/vue/-/vue-2.6.12.tgz

> npm cache clean make-fetch-happen:request-cache:https://registry.npmjs.org/vue

> npm cache clean make-fetch-happen:request-cache:https://registry.npmjs.org/vue

or use shell to batch handle

npm cache ls [email protected] | xargs npm cache clean

Leave a Comment