Used to add, list, or clear the npm cache folder.
add: Add the specified package 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.
ls: Show the data in the cache. Argument is a path to show in the cache folder. Works a bit like the
findprogram, but limited by the
clean: Delete data out of the cache folder. If an argument is provided, then it specifies a subpath to delete. If no argument is provided, then the entire cache is cleared.
npm stores cache data in the directory specified in
npm config get cache.
For each package that is added to the cache, three pieces of information are
- .../package/package.json: The package.json file, as npm sees it.
- .../package.tgz: The tarball for that version.
Additionally, whenever a registry request is made, a
is placed at the corresponding URI, to store the ETag and the requested
data. This is stored in
Commands that make non-essential registry requests (such as
view, or the completion scripts) generally specify a minimum timeout.
.cache.json file is younger than the specified timeout, then
they do not make an HTTP request to the registry.
~/.npm on Posix, or
%AppData%/npm-cache on Windows.
The root cache folder.