5 <link rel="stylesheet" type="text/css" href="../../static/style.css">
6 <link rel="canonical" href="https://www.npmjs.org/doc/cli/npm.html">
7 <script async=true src="../../static/toc.js"></script>
12 <h1><a href="../cli/npm.html">npm</a></h1> <p>javascript package manager</p>
13 <h2 id="synopsis">SYNOPSIS</h2>
14 <pre><code>npm <command> [args]
15 </code></pre><h2 id="version">VERSION</h2>
17 <h2 id="description">DESCRIPTION</h2>
18 <p>npm is the package manager for the Node JavaScript platform. It puts
19 modules in place so that node can find them, and manages dependency
20 conflicts intelligently.</p>
21 <p>It is extremely configurable to support a wide variety of use cases.
22 Most commonly, it is used to publish, discover, install, and develop node
24 <p>Run <code>npm help</code> to get a list of available commands.</p>
25 <h2 id="introduction">INTRODUCTION</h2>
26 <p>You probably got npm because you want to install stuff.</p>
27 <p>Use <code>npm install blerg</code> to install the latest version of "blerg". Check out
28 <code><a href="../cli/npm-install.html">npm-install(1)</a></code> for more info. It can do a lot of stuff.</p>
29 <p>Use the <code>npm search</code> command to show everything that's available.
30 Use <code>npm ls</code> to show everything you've installed.</p>
31 <h2 id="dependencies">DEPENDENCIES</h2>
32 <p>If a package references to another package with a git URL, npm depends
33 on a preinstalled git.</p>
34 <p>If one of the packages npm tries to install is a native node module and
35 requires compiling of C++ Code, npm will use
36 <a href="https://github.com/TooTallNate/node-gyp">node-gyp</a> for that task.
37 For a Unix system, <a href="https://github.com/TooTallNate/node-gyp">node-gyp</a>
38 needs Python, make and a buildchain like GCC. On Windows,
39 Python and Microsoft Visual Studio C++ are needed. Python 3 is
40 not supported by <a href="https://github.com/TooTallNate/node-gyp">node-gyp</a>.
41 For more information visit
42 <a href="https://github.com/TooTallNate/node-gyp">the node-gyp repository</a> and
43 the <a href="https://github.com/TooTallNate/node-gyp/wiki">node-gyp Wiki</a>.</p>
44 <h2 id="directories">DIRECTORIES</h2>
45 <p>See <code><a href="../files/npm-folders.html">npm-folders(5)</a></code> to learn about where npm puts stuff.</p>
46 <p>In particular, npm has two modes of operation:</p>
48 <li>global mode:<br>npm installs packages into the install prefix at
49 <code>prefix/lib/node_modules</code> and bins are installed in <code>prefix/bin</code>.</li>
50 <li>local mode:<br>npm installs packages into the current project directory, which
51 defaults to the current working directory. Packages are installed to
52 <code>./node_modules</code>, and bins are installed to <code>./node_modules/.bin</code>.</li>
54 <p>Local mode is the default. Use <code>--global</code> or <code>-g</code> on any command to
55 operate in global mode instead.</p>
56 <h2 id="developer-usage">DEVELOPER USAGE</h2>
57 <p>If you're using npm to develop and publish your code, check out the
58 following help topics:</p>
61 Make a package.json file. See <code><a href="../files/package.json.html">package.json(5)</a></code>.</li>
63 For linking your current working code into Node's path, so that you
64 don't have to reinstall every time you make a change. Use
65 <code>npm link</code> to do this.</li>
67 It's a good idea to install things if you don't need the symbolic link.
68 Especially, installing other peoples code from the registry is done via
69 <code>npm install</code></li>
71 Create an account or log in. Credentials are stored in the
72 user config file.</li>
74 Use the <code>npm publish</code> command to upload your code to the registry.</li>
76 <h2 id="configuration">CONFIGURATION</h2>
77 <p>npm is extremely configurable. It reads its configuration options from
80 <li>Command line switches:<br>Set a config with <code>--key val</code>. All keys take a value, even if they
81 are booleans (the config parser doesn't know what the options are at
82 the time of parsing.) If no value is provided, then the option is set
83 to boolean <code>true</code>.</li>
84 <li>Environment Variables:<br>Set any config by prefixing the name in an environment variable with
85 <code>npm_config_</code>. For example, <code>export npm_config_key=val</code>.</li>
86 <li>User Configs:<br>The file at $HOME/.npmrc is an ini-formatted list of configs. If
87 present, it is parsed. If the <code>userconfig</code> option is set in the cli
88 or env, then that will be used instead.</li>
89 <li>Global Configs:<br>The file found at ../etc/npmrc (from the node executable, by default
90 this resolves to /usr/local/etc/npmrc) will be parsed if it is found.
91 If the <code>globalconfig</code> option is set in the cli, env, or user config,
92 then that file is parsed instead.</li>
93 <li>Defaults:<br>npm's default configuration options are defined in
94 lib/utils/config-defs.js. These must not be changed.</li>
96 <p>See <code><a href="../misc/npm-config.html">npm-config(7)</a></code> for much much more information.</p>
97 <h2 id="contributions">CONTRIBUTIONS</h2>
98 <p>Patches welcome!</p>
101 Read through <code><a href="../misc/npm-coding-style.html">npm-coding-style(7)</a></code> if you plan to submit code.
102 You don't have to agree with it, but you do have to follow it.</li>
104 If you find an error in the documentation, edit the appropriate markdown
105 file in the "doc" folder. (Don't worry about generating the man page.)</li>
107 <p>Contributors are listed in npm's <code>package.json</code> file. You can view them
108 easily by doing <code>npm view npm contributors</code>.</p>
109 <p>If you would like to contribute, but don't know what to work on, read
110 the contributing guidelines and check the issues list.</p>
112 <li><a href="https://github.com/npm/npm/wiki/Contributing-Guidelines">https://github.com/npm/npm/wiki/Contributing-Guidelines</a></li>
113 <li><a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a></li>
115 <h2 id="bugs">BUGS</h2>
116 <p>When you find issues, please report them:</p>
119 <a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a></li>
121 <p>Be sure to include <em>all</em> of the output from the npm command that didn't work
122 as expected. The <code>npm-debug.log</code> file is also helpful to provide.</p>
123 <p>You can also look for isaacs in #node.js on irc://irc.freenode.net. He
124 will no doubt tell you to put the output in a gist or email.</p>
125 <h2 id="author">AUTHOR</h2>
126 <p><a href="http://blog.izs.me/">Isaac Z. Schlueter</a> ::
127 <a href="https://github.com/isaacs/">isaacs</a> ::
128 <a href="http://twitter.com/izs">@izs</a> ::
129 <a href="mailto:i@izs.me">i@izs.me</a></p>
130 <h2 id="see-also">SEE ALSO</h2>
132 <li><a href="../cli/npm-help.html">npm-help(1)</a></li>
133 <li><a href="../misc/npm-faq.html">npm-faq(7)</a></li>
134 <li><a href="../../doc/README.html">README</a></li>
135 <li><a href="../files/package.json.html">package.json(5)</a></li>
136 <li><a href="../cli/npm-install.html">npm-install(1)</a></li>
137 <li><a href="../cli/npm-config.html">npm-config(1)</a></li>
138 <li><a href="../misc/npm-config.html">npm-config(7)</a></li>
139 <li><a href="../files/npmrc.html">npmrc(5)</a></li>
140 <li><a href="../misc/npm-index.html">npm-index(7)</a></li>
141 <li><a href="../api/npm.html">npm(3)</a></li>
146 <table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
147 <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
148 <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>
149 <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>
150 <tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
151 <tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
152 <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>
153 <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>
155 <p id="footer">npm — npm@2.15.11</p>