Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is Yarn storing offline packages?

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.

like image 922
rraallvv Avatar asked Dec 23 '17 13:12

rraallvv


People also ask

Where does Yarn store packages?

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.

Where is Yarn cache located?

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.

What is offline cache?

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.


2 Answers

You can run yarn cache dir to list the cache location on your system.

like image 165
safety Avatar answered Oct 16 '22 17:10

safety


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

like image 39
rieckpil Avatar answered Oct 16 '22 17:10

rieckpil