Search code examples
node.jsreact-nativenpmyarnpkg

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.


Solution

  • 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