3 <title>npm-cache</title>
4 <meta http-equiv="content-type" value="text/html;utf-8">
5 <link rel="stylesheet" type="text/css" href="../../static/style.css">
6 <link rel="canonical" href="https://www.npmjs.org/doc/cli/npm-cache.html">
7 <script async=true src="../../static/toc.js"></script>
12 <h1><a href="../cli/npm-cache.html">npm-cache</a></h1> <p>Manipulates packages cache</p>
14 <h2 id="SYNOPSIS">SYNOPSIS</h2>
16 <pre><code>npm cache add <tarball file>
17 npm cache add <folder>
18 npm cache add <tarball url>
19 npm cache add <name>@<version>
21 npm cache ls [<path>]
23 npm cache clean [<path>]</code></pre>
25 <h2 id="DESCRIPTION">DESCRIPTION</h2>
27 <p>Used to add, list, or clear the npm cache folder.</p>
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.</p></li><li><p>ls:
33 Show the data in the cache. Argument is a path to show in the cache
34 folder. Works a bit like the <code>find</code> program, but limited by the
35 <code>depth</code> config.</p></li><li><p>clean:
36 Delete data out of the cache folder. If an argument is provided, then
37 it specifies a subpath to delete. If no argument is provided, then
38 the entire cache is cleared.</p></li></ul>
40 <h2 id="DETAILS">DETAILS</h2>
42 <p>npm stores cache data in the directory specified in <code>npm config get cache</code>.
43 For each package that is added to the cache, three pieces of information are
44 stored in <code>{cache}/{name}/{version}</code>:</p>
47 A folder containing the package contents as they appear in the tarball.</li><li>.../package.json:
48 The package.json file, as npm sees it, with overlays applied and a _id attribute.</li><li>.../package.tgz:
49 The tarball for that version.</li></ul>
51 <p>Additionally, whenever a registry request is made, a <code>.cache.json</code> file
52 is placed at the corresponding URI, to store the ETag and the requested
55 <p>Commands that make non-essential registry requests (such as <code>search</code> and
56 <code>view</code>, or the completion scripts) generally specify a minimum timeout.
57 If the <code>.cache.json</code> file is younger than the specified timeout, then
58 they do not make an HTTP request to the registry.</p>
60 <h2 id="CONFIGURATION">CONFIGURATION</h2>
62 <h3 id="cache">cache</h3>
64 <p>Default: <code>~/.npm</code> on Posix, or <code>%AppData%/npm-cache</code> on Windows.</p>
66 <p>The root cache folder.</p>
68 <h2 id="SEE-ALSO">SEE ALSO</h2>
70 <ul><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../cli/npm-pack.html">npm-pack(1)</a></li></ul>
73 <table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
74 <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
75 <tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td colspan=6 style="width:60px;height:10px;background:#fff"> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td></tr>
76 <tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2> </td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td></tr>
77 <tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
78 <tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
79 <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
80 <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
82 <p id="footer">npm-cache — npm@1.4.8</p>