You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Used to add, list, or clean the `npm cache` folder.
14
+
Also used to view info about entries in the `npm exec` (aka `npx`) cache folder.
15
+
16
+
#### `npm cache`
14
17
15
18
* add:
16
-
Add the specified packages to the local cache. This command is primarily
17
-
intended to be used internally by npm, but it can provide a way to
18
-
add data to the local installation cache explicitly.
19
+
Add the specified packages to the local cache. This command is primarily intended to be used internally by npm, but it can provide a way to add data to the local installation cache explicitly.
19
20
20
21
* clean:
21
-
Delete all data out of the cache folder. Note that this is typically
22
-
unnecessary, as npm's cache is self-healing and resistant to data
23
-
corruption issues.
22
+
Delete a single entry or all entries out of the cache folder. Note that this is typically unnecessary, as npm's cache is self-healing and resistant to data corruption issues.
23
+
24
+
* ls:
25
+
List given entries or all entries in the local cache.
24
26
25
27
* verify:
26
-
Verify the contents of the cache folder, garbage collecting any unneeded
27
-
data, and verifying the integrity of the cache index and all cached data.
28
+
Verify the contents of the cache folder, garbage collecting any unneeded data, and verifying the integrity of the cache index and all cached data.
29
+
30
+
#### `npm cache npx`
31
+
32
+
* ls:
33
+
List all entries in the npx cache.
34
+
35
+
* rm:
36
+
Remove given entries or all entries from the npx cache.
37
+
38
+
* info:
39
+
Get detailed information about given entries in the npx cache.
28
40
29
41
### Details
30
42
31
-
npm stores cache data in an opaque directory within the configured `cache`,
32
-
named `_cacache`. This directory is a
33
-
[`cacache`](http://npm.im/cacache)-based content-addressable cache that
34
-
stores all http request data as well as other package-related data. This
35
-
directory is primarily accessed through `pacote`, the library responsible
36
-
for all package fetching as of npm@5.
43
+
npm stores cache data in an opaque directory within the configured `cache`, named `_cacache`. This directory is a [`cacache`](http://npm.im/cacache)-based content-addressable cache that stores all http request data as well as other package-related data. This directory is primarily accessed through `pacote`, the library responsible for all package fetching as of npm@5.
37
44
38
-
All data that passes through the cache is fully verified for integrity on
39
-
both insertion and extraction. Cache corruption will either trigger an
40
-
error, or signal to `pacote` that the data must be refetched, which it will
41
-
do automatically. For this reason, it should never be necessary to clear
42
-
the cache for any reason other than reclaiming disk space, thus why `clean`
43
-
now requires `--force` to run.
45
+
All data that passes through the cache is fully verified for integrity on both insertion and extraction. Cache corruption will either trigger an error, or signal to `pacote` that the data must be refetched, which it will do automatically. For this reason, it should never be necessary to clear the cache for any reason other than reclaiming disk space, thus why `clean` now requires `--force` to run.
44
46
45
-
There is currently no method exposed through npm to inspect or directly
46
-
manage the contents of this cache. In order to access it, `cacache` must be
47
-
used directly.
47
+
There is currently no method exposed through npm to inspect or directly manage the contents of this cache. In order to access it, `cacache` must be used directly.
48
48
49
-
npm will not remove data by itself: the cache will grow as new packages are
50
-
installed.
49
+
npm will not remove data by itself: the cache will grow as new packages are installed.
51
50
52
51
### A note about the cache's design
53
52
54
-
The npm cache is strictly a cache: it should not be relied upon as a
55
-
persistent and reliable data store for package data. npm makes no guarantee
56
-
that a previously-cached piece of data will be available later, and will
57
-
automatically delete corrupted contents. The primary guarantee that the
58
-
cache makes is that, if it does return data, that data will be exactly the
59
-
data that was inserted.
53
+
The npm cache is strictly a cache: it should not be relied upon as a persistent and reliable data store for package data. npm makes no guarantee that a previously-cached piece of data will be available later, and will automatically delete corrupted contents. The primary guarantee that the cache makes is that, if it does return data, that data will be exactly the data that was inserted.
60
54
61
55
To run an offline verification of existing cache contents, use `npm cache
0 commit comments