yarn cache

yarn cache list [--pattern]

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 list --pattern <pattern> will print out every cached package that matches the pattern provided.

Examples:

yarn cache list --pattern gulp
yarn cache list --pattern "gulp|grunt"
yarn cache list --pattern "gulp-(match|newer)"
yarn cache dir

Running yarn cache dir will print out the path where yarn’s global cache is currently stored.

yarn cache clean <module_name>

Running this command will clear the global cache. It will be populated again the next time yarn or yarn install is run. Additionally, you can specify name of package you want to clean.

Change the cache path for yarn

Set cache-folder config value to configure the cache directory.

yarn config set cache-folder <path>

You can also specify the cache directory by flag --cache-folder:

yarn <command> --cache-folder <path>

You can also specify the cache directory by environment variable YARN_CACHE_FOLDER:

YARN_CACHE_FOLDER=<path> yarn <command>