[Feature] Does Yarn 2 have any sort of global cache?
See original GitHub issueDescribe the user story
Yarn 1 had a useful feature — it stored global cache, for example in folder /usr/local/share/.cache/yarn
, which could be revealed by running yarn cache dir
.
Having cache like this allowed to mount it to CI runner so that all jobs on runner will have shared cache, and it will be much faster rather than to cache Yarn’s cache per-job.
Yarn 2 does not have such command.
Describe the solution you’d like
Same thing as before. Global cache which will be used as fallback if project’s .yarn/cache
is empty.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Offline Cache | Yarn - Package Manager
An overview of Yarn's offline cache, a feature that allows Yarn to work just fine even should the network go down for any...
Read more >Yarn 2 — the future of package managers for JavaScript? - Snyk
Yarn 2 ticks a quite a few check-boxes on the board that have been keeping developers discussing on how to manage JavaScript projects:...
Read more >Introducing Yarn 2 ! - DEV Community
New features will be developed exclusively against Yarn 2. ... if the cache becomes part of your repository then you never need to...
Read more >Building a Monorepo with Yarn 2 - Heroku Blog
We will cover taking advantage of Yarn 2's cache to manage ... Your JavaScript server has source code, but there's an additional front...
Read more >Yarn 2 needs proper support in builds - Features
Currently Netlify does a few things that are bad for Yarn 2 users: Caches the node_modules ... every single build (one from Netlify...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@phuctm97 in my case
yarn config get cacheFolder
returns me%PROJECT_DIR%/.yarn/cache
which is project’s folder, not system-wide cache folder.@arcanis I think this issue has to be reopened, since it will give a lot of benefits for CI like Gitlab. There’s still no solution how to determine which system-wide folder Yarn 2 is using.
enableGlobalCache
is a bit different, I need both:@kirill-konshin I share the same use case with you that I want to be able to save/attach cache to optimize CI/CD resources.
I ended up caching Yarn’s local cache folder and everything works just fine. Why don’t you do that, is there any complication or unseen issue, or you just didn’t think of it?
Following is how I cache Yarn’s local cache folder and the results:
Before applying cache:
After applying cache:
Updated CI/CD still bundles my application properly and saves ~85% build time.