npm-cache.1 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. .TH "NPM\-CACHE" "1" "August 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-cache\fR \- Manipulates packages cache
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm cache add <tarball file>
  9. npm cache add <folder>
  10. npm cache add <tarball url>
  11. npm cache add <name>@<version>
  12. npm cache clean [<path>]
  13. aliases: npm cache clear, npm cache rm
  14. npm cache verify
  15. .fi
  16. .RE
  17. .SS Description
  18. .P
  19. Used to add, list, or clean the npm cache folder\.
  20. .RS 0
  21. .IP \(bu 2
  22. add:
  23. Add the specified package to the local cache\. This command is primarily
  24. intended to be used internally by npm, but it can provide a way to
  25. add data to the local installation cache explicitly\.
  26. .IP \(bu 2
  27. clean:
  28. Delete all data out of the cache folder\.
  29. .IP \(bu 2
  30. verify:
  31. Verify the contents of the cache folder, garbage collecting any unneeded data,
  32. and verifying the integrity of the cache index and all cached data\.
  33. .RE
  34. .SS Details
  35. .P
  36. npm stores cache data in an opaque directory within the configured \fBcache\fP,
  37. named \fB_cacache\fP\|\. This directory is a \fBcacache\fP\-based content\-addressable cache
  38. that stores all http request data as well as other package\-related data\. This
  39. directory is primarily accessed through \fBpacote\fP, the library responsible for
  40. all package fetching as of npm@5\.
  41. .P
  42. All data that passes through the cache is fully verified for integrity on both
  43. insertion and extraction\. Cache corruption will either trigger an error, or
  44. signal to \fBpacote\fP that the data must be refetched, which it will do
  45. automatically\. For this reason, it should never be necessary to clear the cache
  46. for any reason other than reclaiming disk space, thus why \fBclean\fP now requires
  47. \fB\-\-force\fP to run\.
  48. .P
  49. There is currently no method exposed through npm to inspect or directly manage
  50. the contents of this cache\. In order to access it, \fBcacache\fP must be used
  51. directly\.
  52. .P
  53. npm will not remove data by itself: the cache will grow as new packages are
  54. installed\.
  55. .SS A note about the cache's design
  56. .P
  57. The npm cache is strictly a cache: it should not be relied upon as a persistent
  58. and reliable data store for package data\. npm makes no guarantee that a
  59. previously\-cached piece of data will be available later, and will automatically
  60. delete corrupted contents\. The primary guarantee that the cache makes is that,
  61. if it does return data, that data will be exactly the data that was inserted\.
  62. .P
  63. To run an offline verification of existing cache contents, use \fBnpm cache
  64. verify\fP\|\.
  65. .SS Configuration
  66. .SS cache
  67. .P
  68. Default: \fB~/\.npm\fP on Posix, or \fB%AppData%/npm\-cache\fP on Windows\.
  69. .P
  70. The root cache folder\.
  71. .SS See Also
  72. .RS 0
  73. .IP \(bu 2
  74. npm help folders
  75. .IP \(bu 2
  76. npm help config
  77. .IP \(bu 2
  78. npm help npmrc
  79. .IP \(bu 2
  80. npm help install
  81. .IP \(bu 2
  82. npm help publish
  83. .IP \(bu 2
  84. npm help pack
  85. .IP \(bu 2
  86. https://npm\.im/cacache
  87. .IP \(bu 2
  88. https://npm\.im/pacote
  89. .RE