deps: upgrade to npm 2.14.4
[platform/upstream/nodejs.git] / deps / npm / html / doc / README.html
1 <!doctype html>
2 <html>
3   <title>README</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/README.html">
7   <script async=true src="../../static/toc.js"></script>
8
9   <body>
10     <div id="wrapper">
11
12 <h1><a href="cli/npm.html">npm</a></h1> <p>a JavaScript package manager</p>
13 <p><a href="https://travis-ci.org/npm/npm"><img src="https://img.shields.io/travis/npm/npm/master.svg" alt="Build Status"></a></p>
14 <h2 id="synopsis">SYNOPSIS</h2>
15 <p>This is just enough info to get you up and running.</p>
16 <p>Much more info available via <code>npm help</code> once it&#39;s installed.</p>
17 <h2 id="important">IMPORTANT</h2>
18 <p><strong>You need node v0.8 or higher to run this program.</strong></p>
19 <p>To install an old <strong>and unsupported</strong> version of npm that works on node 0.3
20 and prior, clone the git repo and dig through the old tags and branches.</p>
21 <h2 id="super-easy-install">Super Easy Install</h2>
22 <p>npm is bundled with <a href="http://nodejs.org/download/">node</a>.</p>
23 <h3 id="windows-computers">Windows Computers</h3>
24 <p><a href="http://nodejs.org/download/">Get the MSI</a>.  npm is in it.</p>
25 <h3 id="apple-macintosh-computers">Apple Macintosh Computers</h3>
26 <p><a href="http://nodejs.org/download/">Get the pkg</a>.  npm is in it.</p>
27 <h3 id="other-sorts-of-unices">Other Sorts of Unices</h3>
28 <p>Run <code>make install</code>.  npm will be installed with node.</p>
29 <p>If you want a more fancy pants install (a different version, customized
30 paths, etc.) then read on.</p>
31 <h2 id="fancy-install-unix-">Fancy Install (Unix)</h2>
32 <p>There&#39;s a pretty robust install script at
33 <a href="https://www.npmjs.com/install.sh">https://www.npmjs.com/install.sh</a>.  You can download that and run it.</p>
34 <p>Here&#39;s an example using curl:</p>
35 <pre><code class="lang-sh">curl -L https://www.npmjs.com/install.sh | sh
36 </code></pre>
37 <h3 id="slightly-fancier">Slightly Fancier</h3>
38 <p>You can set any npm configuration params with that script:</p>
39 <pre><code class="lang-sh">npm_config_prefix=/some/path sh install.sh
40 </code></pre>
41 <p>Or, you can run it in uber-debuggery mode:</p>
42 <pre><code class="lang-sh">npm_debug=1 sh install.sh
43 </code></pre>
44 <h3 id="even-fancier">Even Fancier</h3>
45 <p>Get the code with git.  Use <code>make</code> to build the docs and do other stuff.
46 If you plan on hacking on npm, <code>make link</code> is your friend.</p>
47 <p>If you&#39;ve got the npm source code, you can also semi-permanently set
48 arbitrary config keys using the <code>./configure --key=val ...</code>, and then
49 run npm commands by doing <code>node cli.js &lt;cmd&gt; &lt;args&gt;</code>.  (This is helpful
50 for testing, or running stuff without actually installing npm itself.)</p>
51 <h2 id="windows-install-or-upgrade">Windows Install or Upgrade</h2>
52 <p>You can download a zip file from <a href="https://github.com/npm/npm/releases">https://github.com/npm/npm/releases</a>, and
53 unpack it in the <code>node_modules\npm\</code> folder inside node&#39;s installation folder.</p>
54 <p>To upgrade to npm 2, follow the Windows upgrade instructions in
55 the npm Troubleshooting Guide:</p>
56 <p><a href="https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows">https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows</a></p>
57 <p>If that&#39;s not fancy enough for you, then you can fetch the code with
58 git, and mess with it directly.</p>
59 <h2 id="installing-on-cygwin">Installing on Cygwin</h2>
60 <p>No.</p>
61 <h2 id="uninstalling">Uninstalling</h2>
62 <p>So sad to see you go.</p>
63 <pre><code class="lang-sh">sudo npm uninstall npm -g
64 </code></pre>
65 <p>Or, if that fails,</p>
66 <pre><code class="lang-sh">sudo make uninstall
67 </code></pre>
68 <h2 id="more-severe-uninstalling">More Severe Uninstalling</h2>
69 <p>Usually, the above instructions are sufficient.  That will remove
70 npm, but leave behind anything you&#39;ve installed.</p>
71 <p>If you would like to remove all the packages that you have installed,
72 then you can use the <code>npm ls</code> command to find them, and then <code>npm rm</code> to
73 remove them.</p>
74 <p>To remove cruft left behind by npm 0.x, you can use the included
75 <code>clean-old.sh</code> script file.  You can run it conveniently like this:</p>
76 <pre><code class="lang-sh">npm explore npm -g -- sh scripts/clean-old.sh
77 </code></pre>
78 <p>npm uses two configuration files, one for per-user configs, and another
79 for global (every-user) configs.  You can view them by doing:</p>
80 <pre><code class="lang-sh">npm config get userconfig   # defaults to ~/.npmrc
81 npm config get globalconfig # defaults to /usr/local/etc/npmrc
82 </code></pre>
83 <p>Uninstalling npm does not remove configuration files by default.  You
84 must remove them yourself manually if you want them gone.  Note that
85 this means that future npm installs will not remember the settings that
86 you have chosen.</p>
87 <h2 id="using-npm-programmatically">Using npm Programmatically</h2>
88 <p>Although npm can be used programmatically, its API is meant for use by the CLI
89 <em>only</em>, and no guarantees are made regarding its fitness for any other purpose.
90 If you want to use npm to reliably perform some task, the safest thing to do is
91 to invoke the desired <code>npm</code> command with appropriate arguments.</p>
92 <p>The semantic version of npm refers to the CLI itself, rather than the
93 underlying API. <em>The internal API is not guaranteed to remain stable even when
94 npm&#39;s version indicates no breaking changes have been made according to
95 semver.</em></p>
96 <p>If you <em>still</em> would like to use npm programmatically, it&#39;s <em>possible</em>. The API
97 isn&#39;t very well documented, but it <em>is</em> rather simple.</p>
98 <p>Eventually, npm will be just a thin CLI wrapper around the modules that it
99 depends on, but for now, there are some things that only the CLI can do. You
100 should try using one of npm&#39;s dependencies first, and only use the API if what
101 you&#39;re trying to do is only supported by npm itself.</p>
102 <pre><code class="lang-javascript">var npm = require(&quot;npm&quot;)
103 npm.load(myConfigObject, function (er) {
104   if (er) return handlError(er)
105   npm.commands.install([&quot;some&quot;, &quot;args&quot;], function (er, data) {
106     if (er) return commandFailed(er)
107     // command succeeded, and data might have some info
108   })
109   npm.registry.log.on(&quot;log&quot;, function (message) { .... })
110 })
111 </code></pre>
112 <p>The <code>load</code> function takes an object hash of the command-line configs.
113 The various <code>npm.commands.&lt;cmd&gt;</code> functions take an <strong>array</strong> of
114 positional argument <strong>strings</strong>.  The last argument to any
115 <code>npm.commands.&lt;cmd&gt;</code> function is a callback.  Some commands take other
116 optional arguments.  Read the source.</p>
117 <p>You cannot set configs individually for any single npm function at this
118 time.  Since <code>npm</code> is a singleton, any call to <code>npm.config.set</code> will
119 change the value for <em>all</em> npm commands in that process.</p>
120 <p>See <code>./bin/npm-cli.js</code> for an example of pulling config values off of the
121 command line arguments using nopt.  You may also want to check out <code>npm
122 help config</code> to learn about all the options you can set there.</p>
123 <h2 id="more-docs">More Docs</h2>
124 <p>Check out the <a href="https://docs.npmjs.com/">docs</a>,
125 especially the <a href="https://docs.npmjs.com/misc/faq">faq</a>.</p>
126 <p>You can use the <code>npm help</code> command to read any of them.</p>
127 <p>If you&#39;re a developer, and you want to use npm to publish your program,
128 you should <a href="https://docs.npmjs.com/misc/developers">read this</a></p>
129 <h2 id="legal-stuff">Legal Stuff</h2>
130 <p>&quot;npm&quot; and &quot;The npm Registry&quot; are owned by npm, Inc.
131 All rights reserved.  See the included LICENSE file for more details.</p>
132 <p>&quot;Node.js&quot; and &quot;node&quot; are trademarks owned by Joyent, Inc.</p>
133 <p>Modules published on the npm registry are not officially endorsed by
134 npm, Inc. or the Node.js project.</p>
135 <p>Data published to the npm registry is not part of npm itself, and is
136 the sole property of the publisher.  While every effort is made to
137 ensure accountability, there is absolutely no guarantee, warranty, or
138 assertion expressed or implied as to the quality, fitness for a
139 specific purpose, or lack of malice in any given npm package.</p>
140 <p>If you have a complaint about a package in the public npm registry,
141 and cannot <a href="https://docs.npmjs.com/misc/disputes">resolve it with the package
142 owner</a>, please email
143 <a href="&#x6d;&#x61;&#105;&#108;&#x74;&#x6f;&#x3a;&#x73;&#x75;&#x70;&#x70;&#111;&#114;&#x74;&#x40;&#x6e;&#x70;&#x6d;&#x6a;&#x73;&#46;&#x63;&#x6f;&#109;">&#x73;&#x75;&#x70;&#x70;&#111;&#114;&#x74;&#x40;&#x6e;&#x70;&#x6d;&#x6a;&#x73;&#46;&#x63;&#x6f;&#109;</a> and explain the situation.</p>
144 <p>Any data published to The npm Registry (including user account
145 information) may be removed or modified at the sole discretion of the
146 npm server administrators.</p>
147 <h3 id="in-plainer-english">In plainer english</h3>
148 <p>npm is the property of npm, Inc.</p>
149 <p>If you publish something, it&#39;s yours, and you are solely accountable
150 for it.</p>
151 <p>If other people publish something, it&#39;s theirs.</p>
152 <p>Users can publish Bad Stuff.  It will be removed promptly if reported.
153 But there is no vetting process for published modules, and you use
154 them at your own risk.  Please inspect the source.</p>
155 <p>If you publish Bad Stuff, we may delete it from the registry, or even
156 ban your account in extreme cases.  So don&#39;t do that.</p>
157 <h2 id="bugs">BUGS</h2>
158 <p>When you find issues, please report them:</p>
159 <ul>
160 <li>web:
161 <a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a></li>
162 </ul>
163 <p>Be sure to include <em>all</em> of the output from the npm command that didn&#39;t work
164 as expected.  The <code>npm-debug.log</code> file is also helpful to provide.</p>
165 <p>You can also look for isaacs in #node.js on irc://irc.freenode.net.  He
166 will no doubt tell you to put the output in a gist or email.</p>
167 <h2 id="see-also">SEE ALSO</h2>
168 <ul>
169 <li><a href="cli/npm.html">npm(1)</a></li>
170 <li><a href="misc/npm-faq.html">npm-faq(7)</a></li>
171 <li><a href="cli/npm-help.html">npm-help(1)</a></li>
172 <li><a href="misc/npm-index.html">npm-index(7)</a></li>
173 </ul>
174
175 </div>
176
177 <table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
178 <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18>&nbsp;</td></tr>
179 <tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td colspan=6 style="width:60px;height:10px;background:#fff">&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td></tr>
180 <tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2>&nbsp;</td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td></tr>
181 <tr><td style="width:10px;height:10px;background:#fff" rowspan=2>&nbsp;</td></tr>
182 <tr><td style="width:10px;height:10px;background:#fff">&nbsp;</td></tr>
183 <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6>&nbsp;</td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td></tr>
184 <tr><td colspan=5 style="width:50px;height:10px;background:#fff">&nbsp;</td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4>&nbsp;</td><td style="width:90px;height:10px;background:#fff" colspan=9>&nbsp;</td></tr>
185 </table>
186 <p id="footer"><a href="../doc/README.html">README</a> &mdash; npm@2.14.4</p>
187