Where Does Yarn Store Its Cache?
Yarn Classic and Berry cache folders on Windows, macOS and Linux, and how to clear them without breaking offline installs.
Last updated
Yarn Classic caches tarballs under a per OS cache root with a berry versus classic split in newer releases. Berry stores content addressed files under .yarn with a cache sibling per project when zero installs are on. The global folder holds shared binaries.
Run yarn cache dir to print the live Classic path instead of trusting guides. Clearing forces full redownloads, so try it per project first. The .pnp files in Berry projects replace node_modules and must stay with package.json on every copy.
Where Yarn stores this, by platform
%localappdata%\Yarn\Cache
Run yarn cache dir to confirm. Berry projects keep .yarn/cache inside the repo. Delete Cache contents with editors closed to force clean fetches.
~/Library/Caches/Yarn
Same yarn cache dir command applies. Global binaries sit in ~/.config/yarn/global with links into the user bin folder.
~/.cache/yarn
Respects XDG_CACHE_HOME when set. CI images persist this path between runs to skip downloads. Berry zero install repos carry their own cache.
Frequently asked questions
How do I clear the Yarn cache safely?
Run yarn cache clean for Classic, or delete .yarn/cache in one Berry repo to test. Reinstall once and confirm the build before wiping shared caches globally.
Where are Yarn global binaries?
In the global folder beside the cache: ~/.config/yarn/global on Mac and Linux, %localappdata%/Yarn/Data/global on Windows. Keep its bin on PATH.
Notice an outdated path? Let us know.