1NPM-CACHE(1) NPM-CACHE(1)
2
3
4
6 npm-cache - Manipulates packages cache
7
8 Synopsis
9 npm cache add <tarball file>...
10 npm cache add <folder>...
11 npm cache add <tarball url>...
12 npm cache add <name>@<version>...
13
14 npm cache clean
15 aliases: npm cache clear, npm cache rm
16
17 npm cache verify
18
19 Note: This command is unaware of workspaces.
20
21 Description
22 Used to add, list, or clean the npm cache folder.
23
24 • add: Add the specified packages to the local cache. This command is
25 primarily intended to be used internally by npm, but it can provide a
26 way to add data to the local installation cache explicitly.
27
28 • clean: Delete all data out of the cache folder. Note that this is
29 typically unnecessary, as npm's cache is self-healing and resistant
30 to data corruption issues.
31
32 • verify: Verify the contents of the cache folder, garbage collecting
33 any unneeded data, and verifying the integrity of the cache index and
34 all cached data.
35
36
37 Details
38 npm stores cache data in an opaque directory within the configured
39 cache, named _cacache. This directory is a cacache http://npm.im/ca‐
40 cache-based content-addressable cache that stores all http request data
41 as well as other package-related data. This directory is primarily ac‐
42 cessed through pacote, the library responsible for all package fetching
43 as of npm@5.
44
45 All data that passes through the cache is fully verified for integrity
46 on both insertion and extraction. Cache corruption will either trigger
47 an error, or signal to pacote that the data must be refetched, which it
48 will do automatically. For this reason, it should never be necessary to
49 clear the cache for any reason other than reclaiming disk space, thus
50 why clean now requires --force to run.
51
52 There is currently no method exposed through npm to inspect or directly
53 manage the contents of this cache. In order to access it, cacache must
54 be used directly.
55
56 npm will not remove data by itself: the cache will grow as new packages
57 are installed.
58
59 A note about the cache's design
60 The npm cache is strictly a cache: it should not be relied upon as a
61 persistent and reliable data store for package data. npm makes no guar‐
62 antee that a previously-cached piece of data will be available later,
63 and will automatically delete corrupted contents. The primary guarantee
64 that the cache makes is that, if it does return data, that data will be
65 exactly the data that was inserted.
66
67 To run an offline verification of existing cache contents, use npm
68 cache verify.
69
70 Configuration
71 <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically
72 generated, do not edit manually --> <!-- see lib/utils/config/defini‐
73 tions.js -->
74
75 cache
76 • Default: Windows: %LocalAppData%\npm-cache, Posix: ~/.npm
77
78 • Type: Path
79
80
81 The location of npm's cache directory. See npm help npm cache <!-- au‐
82 tomatically generated, do not edit manually --> <!-- see lib/utils/con‐
83 fig/definitions.js -->
84
85 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
86
87
88 See Also
89 • npm help folders
90
91 • npm help config
92
93 • npm help npmrc
94
95 • npm help install
96
97 • npm help publish
98
99 • npm help pack
100
101 • https://npm.im/cacache
102
103 • https://npm.im/pacote
104
105 • https://npm.im/@npmcli/arborist
106
107 • https://npm.im/make-fetch-happen
108
109
110
111
112 October 2021 NPM-CACHE(1)