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