I'm trying to install all the dependencies for this repo: https://github.com/react-community/react-navigation
The problem is that Yarn seems to have stored offline packages somewhere other than the cache directory and it quickly ran out of space in my system drive. I cleaned the cache (yarn cache clean
) and deleted the modules folder (node_modules/
), then ran yarn
and sure enough it installed about 4GB of dependencies in less than 5 mins (with an internet connection of 2 MBits)
As a side note, I'd like to know if there is a way to disable the cache in both yarn
and npm
.
Yarn stores every package in a global cache in your user directory on the file system. yarn cache list will print out every cached package.
Yarn cache dir is resolved to /home/runner/. cache/yarn/v6 . This is because yarn --version is called in the default directory, which is followed by yarn cache dir instead of yarn config get cacheFolder inside tooling . Cache end up empty and so all packages are re-downloaded again each time.
The offline cache is a feature that allows Yarn to work just fine even should the network go down for any reason - whether it's because your employer didn't pay the utility bill or because the place where your packages are hosted becomes unavailable.
You can run yarn cache dir
to list the cache location on your system.
As https://github.com/yarnpkg/yarn/issues/2049 says they are stored at this positions:
%LOCALAPPDATA%/Yarn/config/global on Windows ~/.config/yarn/global on OSX and non-root Linux /usr/local/share/.config/yarn/global on Linux if logged in as root
And I think disabling cache is currently an open topic for yarn: https://github.com/yarnpkg/rfcs/pull/53
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With