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.

示例:

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

运行 yarn cache dir 会打印出当前的 yarn 全局缓存在哪里。

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.

改变 yarn 缓存路径

设置 cache-folder 来配置缓存目录。

yarn config set cache-folder <path>

你也可以用 --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>