You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cache.md 1.7 kB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---
  2. id: docs_cli_cache
  3. guide: docs_cli
  4. layout: guide
  5. ---
  6. ##### `yarn cache list [--pattern]` <a class="toc" id="toc-yarn-cache-list-pattern" href="#toc-yarn-cache-list-pattern"></a>
  7. Yarn stores every package in a global cache in your user directory on the file
  8. system. `yarn cache list` will print out every cached package.
  9. `yarn cache list --pattern <pattern>` will print out every cached package that matches the pattern provided.
  10. Examples:
  11. ```sh
  12. yarn cache list --pattern gulp
  13. yarn cache list --pattern "gulp|grunt"
  14. yarn cache list --pattern "gulp-(match|newer)"
  15. ```
  16. ##### `yarn cache dir` <a class="toc" id="toc-yarn-cache-dir" href="#toc-yarn-cache-dir"></a>
  17. Running `yarn cache dir` will print out the path where yarn's global cache is currently stored.
  18. ##### `yarn cache clean [<module_name...>]` <a class="toc" id="toc-yarn-cache-clean" href="#toc-yarn-cache-clean"></a>
  19. Running this command will clear the global cache. It will be populated again the
  20. next time `yarn` or `yarn install` is run. Additionally, you can specify one or more packages that you want to clean.
  21. ### Change the cache path for yarn <a class="toc" id="toc-change-the-cache-path-for-yarn" href="#toc-change-the-cache-path-for-yarn"></a>
  22. Set `cache-folder` config value to configure the cache directory.
  23. ```sh
  24. yarn config set cache-folder <path>
  25. ```
  26. You can also specify the cache directory by flag `--cache-folder`:
  27. ```sh
  28. yarn <command> --cache-folder <path>
  29. ```
  30. You can also specify the cache directory by environment variable `YARN_CACHE_FOLDER`:
  31. ```sh
  32. YARN_CACHE_FOLDER=<path> yarn <command>
  33. ```
  34. Yarn will also respect `cache=<path>` in `.npmrc` for compatibility with npm.

js yarn包管理组件依赖分析

Contributors (1)