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