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