3 <title>npm-config</title>
5 <link rel="stylesheet" type="text/css" href="../../static/style.css">
6 <link rel="canonical" href="https://www.npmjs.org/doc/api/npm-config.html">
7 <script async=true src="../../static/toc.js"></script>
12 <h1><a href="../api/npm-config.html">npm-config</a></h1> <p>Manage the npm configuration files</p>
13 <h2 id="synopsis">SYNOPSIS</h2>
14 <pre><code>npm.commands.config(args, callback)
15 var val = npm.config.get(key)
16 npm.config.set(key, val)
17 </code></pre><h2 id="description">DESCRIPTION</h2>
18 <p>This function acts much the same way as the command-line version. The first
19 element in the array tells config what to do. Possible values are:</p>
21 <li><p><code>set</code></p>
22 <p> Sets a config parameter. The second element in <code>args</code> is interpreted as the
23 key, and the third element is interpreted as the value.</p>
25 <li><p><code>get</code></p>
26 <p> Gets the value of a config parameter. The second element in <code>args</code> is the
27 key to get the value of.</p>
29 <li><p><code>delete</code> (<code>rm</code> or <code>del</code>)</p>
30 <p> Deletes a parameter from the config. The second element in <code>args</code> is the
33 <li><p><code>list</code> (<code>ls</code>)</p>
34 <p> Show all configs that aren't secret. No parameters necessary.</p>
36 <li><p><code>edit</code>:</p>
37 <p> Opens the config file in the default editor. This command isn't very useful
38 programmatically, but it is made available.</p>
41 <p>To programmatically access npm configuration settings, or set them for
42 the duration of a program, use the <code>npm.config.set</code> and <code>npm.config.get</code>
43 functions instead.</p>
44 <h2 id="see-also">SEE ALSO</h2>
46 <li><a href="../api/npm.html">npm(3)</a></li>
51 <table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
52 <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
53 <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>
54 <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>
55 <tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
56 <tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
57 <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>
58 <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>
60 <p id="footer">npm-config — npm@2.15.11</p>