yarn cache clean: Usage & Common Errors
Clear the Yarn package cache.
yarn cache clean empties the Yarn package cache - the fix for a corrupted cached tarball or a checksum mismatch that survives reinstalls.
What it does
Removes cached packages from the global cache directory (yarn cache dir shows where). In Berry the cache is project-local (.yarn/cache) by default, so yarn cache clean clears that store. After cleaning, the next install re-fetches from the registry.
Common usage
yarn cache clean # clear the cache
yarn cache dir # Yarn 1: print cache location
yarn cache clean --all # Berry: clear the whole cacheCommon CI error: checksum mismatch survives reinstall
CI keeps failing with "integrity check failed" / "computed checksum did not match" even after reinstalling, because a corrupt tarball is cached. Clean the cache then reinstall - and key any CI cache on the lockfile hash so a poisoned cache is not restored next run.
yarn cache clean && yarn install --check-cache