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 con‐
36 tent-addressable cache that stores all http request data as well as
37 other package-related data. This directory is primarily accessed
38 through pacote, the library responsible for all package fetching as of
39 npm@5.
40
41 All data that passes through the cache is fully verified for integrity
42 on both insertion and extraction. Cache corruption will either trigger
43 an error, or signal to pacote that the data must be refetched, which it
44 will do automatically. For this reason, it should never be necessary to
45 clear the cache for any reason other than reclaiming disk space, thus
46 why clean now requires --force to run.
47
48 There is currently no method exposed through npm to inspect or directly
49 manage the contents of this cache. In order to access it, cacache must
50 be used directly.
51
52 npm will not remove data by itself: the cache will grow as new packages
53 are installed.
54
55 A note about the cache's design
56 The npm cache is strictly a cache: it should not be relied upon as a
57 persistent and reliable data store for package data. npm makes no guar‐
58 antee that a previously-cached piece of data will be available later,
59 and will automatically delete corrupted contents. The primary guarantee
60 that the cache makes is that, if it does return data, that data will be
61 exactly the data that was inserted.
62
63 To run an offline verification of existing cache contents, use npm
64 cache verify.
65
66 Configuration
67 cache
68 Default: ~/.npm on Posix, or %AppData%/npm-cache on Windows.
69
70 The root cache folder.
71
72 See Also
73 · npm help folders
74
75 · npm help config
76
77 · npm help npmrc
78
79 · npm help install
80
81 · npm help publish
82
83 · npm help pack
84
85 · https://npm.im/cacache
86
87 · https://npm.im/pacote
88
89
90
91
92 March 2020 NPM-CACHE(1)