1<!DOCTYPE html><html><head> 2<meta charset="utf-8"> 3<title>npm</title> 4<style> 5body { 6 background-color: #ffffff; 7 color: #24292e; 8 9 margin: 0; 10 11 line-height: 1.5; 12 13 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; 14} 15#rainbar { 16 height: 10px; 17 background-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff); 18} 19 20a { 21 text-decoration: none; 22 color: #0366d6; 23} 24a:hover { 25 text-decoration: underline; 26} 27 28pre { 29 margin: 1em 0px; 30 padding: 1em; 31 border: solid 1px #e1e4e8; 32 border-radius: 6px; 33 34 display: block; 35 overflow: auto; 36 37 white-space: pre; 38 39 background-color: #f6f8fa; 40 color: #393a34; 41} 42code { 43 font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; 44 font-size: 85%; 45 padding: 0.2em 0.4em; 46 background-color: #f6f8fa; 47 color: #393a34; 48} 49pre > code { 50 padding: 0; 51 background-color: inherit; 52 color: inherit; 53} 54h1, h2, h3 { 55 font-weight: 600; 56} 57 58#logobar { 59 background-color: #333333; 60 margin: 0 auto; 61 padding: 1em 4em; 62} 63#logobar .logo { 64 float: left; 65} 66#logobar .title { 67 font-weight: 600; 68 color: #dddddd; 69 float: left; 70 margin: 5px 0 0 1em; 71} 72#logobar:after { 73 content: ""; 74 display: block; 75 clear: both; 76} 77 78#content { 79 margin: 0 auto; 80 padding: 0 4em; 81} 82 83#table_of_contents > h2 { 84 font-size: 1.17em; 85} 86#table_of_contents ul:first-child { 87 border: solid 1px #e1e4e8; 88 border-radius: 6px; 89 padding: 1em; 90 background-color: #f6f8fa; 91 color: #393a34; 92} 93#table_of_contents ul { 94 list-style-type: none; 95 padding-left: 1.5em; 96} 97#table_of_contents li { 98 font-size: 0.9em; 99} 100#table_of_contents li a { 101 color: #000000; 102} 103 104header.title { 105 border-bottom: solid 1px #e1e4e8; 106} 107header.title > h1 { 108 margin-bottom: 0.25em; 109} 110header.title > .description { 111 display: block; 112 margin-bottom: 0.5em; 113 line-height: 1; 114} 115 116footer#edit { 117 border-top: solid 1px #e1e4e8; 118 margin: 3em 0 4em 0; 119 padding-top: 2em; 120} 121</style> 122</head> 123<body> 124<div id="banner"> 125<div id="rainbar"></div> 126<div id="logobar"> 127<svg class="logo" role="img" height="32" width="32" viewBox="0 0 700 700"> 128<polygon fill="#cb0000" points="0,700 700,700 700,0 0,0"></polygon> 129<polygon fill="#ffffff" points="150,550 350,550 350,250 450,250 450,550 550,550 550,150 150,150"></polygon> 130</svg> 131<div class="title"> 132npm command-line interface 133</div> 134</div> 135</div> 136 137<section id="content"> 138<header class="title"> 139<h1 id="npm">npm</h1> 140<span class="description">javascript package manager</span> 141</header> 142 143<section id="table_of_contents"> 144<h2 id="table-of-contents">Table of contents</h2> 145<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#version">Version</a></li><li><a href="#description">Description</a></li><li><a href="#important">Important</a></li><li><a href="#introduction">Introduction</a></li><li><a href="#dependencies">Dependencies</a></li><li><a href="#directories">Directories</a></li><li><a href="#developer-usage">Developer Usage</a></li><ul><li><a href="#configuration">Configuration</a></li></ul><li><a href="#contributions">Contributions</a></li><li><a href="#bugs">Bugs</a></li><li><a href="#feature-requests">Feature Requests</a></li><li><a href="#see-also">See Also</a></li></ul></div> 146</section> 147 148<div id="_content"><h3 id="synopsis">Synopsis</h3> 149<pre><code class="language-bash">npm 150</code></pre> 151<p>Note: This command is unaware of workspaces.</p> 152<h3 id="version">Version</h3> 153<p>10.5.0</p> 154<h3 id="description">Description</h3> 155<p>npm is the package manager for the Node JavaScript platform. It puts 156modules in place so that node can find them, and manages dependency 157conflicts intelligently.</p> 158<p>It is extremely configurable to support a variety of use cases. Most 159commonly, you use it to publish, discover, install, and develop node 160programs.</p> 161<p>Run <code>npm help</code> to get a list of available commands.</p> 162<h3 id="important">Important</h3> 163<p>npm comes preconfigured to use npm's public registry at 164<a href="https://registry.npmjs.org">https://registry.npmjs.org</a> by default. Use of the npm public registry is 165subject to terms of use available at 166<a href="https://docs.npmjs.com/policies/terms">https://docs.npmjs.com/policies/terms</a>.</p> 167<p>You can configure npm to use any compatible registry you like, and even 168run your own registry. Use of someone else's registry is governed by 169their terms of use.</p> 170<h3 id="introduction">Introduction</h3> 171<p>You probably got npm because you want to install stuff.</p> 172<p>The very first thing you will most likely want to run in any node 173program is <code>npm install</code> to install its dependencies.</p> 174<p>You can also run <code>npm install blerg</code> to install the latest version of 175"blerg". Check out <a href="../commands/npm-install.html"><code>npm install</code></a> for more 176info. It can do a lot of stuff.</p> 177<p>Use the <code>npm search</code> command to show everything that's available in the 178public registry. Use <code>npm ls</code> to show everything you've installed.</p> 179<h3 id="dependencies">Dependencies</h3> 180<p>If a package lists a dependency using a git URL, npm will install that 181dependency using the <a href="https://github.com/git-guides/install-git"><code>git</code></a> 182command and will generate an error if it is not installed.</p> 183<p>If one of the packages npm tries to install is a native node module and 184requires compiling of C++ Code, npm will use 185<a href="https://github.com/nodejs/node-gyp">node-gyp</a> for that task. 186For a Unix system, <a href="https://github.com/nodejs/node-gyp">node-gyp</a> 187needs Python, make and a buildchain like GCC. On Windows, 188Python and Microsoft Visual Studio C++ are needed. For more information 189visit <a href="https://github.com/nodejs/node-gyp">the node-gyp repository</a> and 190the <a href="https://github.com/nodejs/node-gyp/wiki">node-gyp Wiki</a>.</p> 191<h3 id="directories">Directories</h3> 192<p>See <a href="../configuring-npm/folders.html"><code>folders</code></a> to learn about where npm puts 193stuff.</p> 194<p>In particular, npm has two modes of operation:</p> 195<ul> 196<li>local mode: 197npm installs packages into the current project directory, which 198defaults to the current working directory. Packages install to 199<code>./node_modules</code>, and bins to <code>./node_modules/.bin</code>.</li> 200<li>global mode: 201npm installs packages into the install prefix at 202<code>$npm_config_prefix/lib/node_modules</code> and bins to 203<code>$npm_config_prefix/bin</code>.</li> 204</ul> 205<p>Local mode is the default. Use <code>-g</code> or <code>--global</code> on any command to 206run in global mode instead.</p> 207<h3 id="developer-usage">Developer Usage</h3> 208<p>If you're using npm to develop and publish your code, check out the 209following help topics:</p> 210<ul> 211<li>json: 212Make a package.json file. See 213<a href="../configuring-npm/package-json.html"><code>package.json</code></a>.</li> 214<li>link: 215Links your current working code into Node's path, so that you don't 216have to reinstall every time you make a change. Use <a href="../commands/npm-link.html"><code>npm link</code></a> to do this.</li> 217<li>install: 218It's a good idea to install things if you don't need the symbolic 219link. Especially, installing other peoples code from the registry is 220done via <a href="../commands/npm-install.html"><code>npm install</code></a></li> 221<li>adduser: 222Create an account or log in. When you do this, npm will store 223credentials in the user config file.</li> 224<li>publish: 225Use the <a href="../commands/npm-publish.html"><code>npm publish</code></a> command to upload your 226code to the registry.</li> 227</ul> 228<h4 id="configuration">Configuration</h4> 229<p>npm is extremely configurable. It reads its configuration options from 2305 places.</p> 231<ul> 232<li>Command line switches: 233Set a config with <code>--key val</code>. All keys take a value, even if they 234are booleans (the config parser doesn't know what the options are at 235the time of parsing). If you do not provide a value (<code>--key</code>) then 236the option is set to boolean <code>true</code>.</li> 237<li>Environment Variables: 238Set any config by prefixing the name in an environment variable with 239<code>npm_config_</code>. For example, <code>export npm_config_key=val</code>.</li> 240<li>User Configs: 241The file at <code>$HOME/.npmrc</code> is an ini-formatted list of configs. If 242present, it is parsed. If the <code>userconfig</code> option is set in the cli 243or env, that file will be used instead.</li> 244<li>Global Configs: 245The file found at <code>./etc/npmrc</code> (relative to the global prefix will be 246parsed if it is found. See <a href="../commands/npm-prefix.html"><code>npm prefix</code></a> for 247more info on the global prefix. If the <code>globalconfig</code> option is set 248in the cli, env, or user config, then that file is parsed instead.</li> 249<li>Defaults: 250npm's default configuration options are defined in 251<code>lib/utils/config/definitions.js</code>. These must not be changed.</li> 252</ul> 253<p>See <a href="../using-npm/config.html"><code>config</code></a> for much much more information.</p> 254<h3 id="contributions">Contributions</h3> 255<p>Patches welcome!</p> 256<p>If you would like to help, but don't know what to work on, read the 257<a href="https://github.com/npm/cli/blob/latest/CONTRIBUTING.md">contributing 258guidelines</a> and 259check the issues list.</p> 260<h3 id="bugs">Bugs</h3> 261<p>When you find issues, please report them: 262<a href="https://github.com/npm/cli/issues">https://github.com/npm/cli/issues</a></p> 263<p>Please be sure to follow the template and bug reporting guidelines.</p> 264<h3 id="feature-requests">Feature Requests</h3> 265<p>Discuss new feature ideas on our discussion forum:</p> 266<ul> 267<li><a href="https://github.com/npm/feedback">https://github.com/npm/feedback</a></li> 268</ul> 269<p>Or suggest formal RFC proposals:</p> 270<ul> 271<li><a href="https://github.com/npm/rfcs">https://github.com/npm/rfcs</a></li> 272</ul> 273<h3 id="see-also">See Also</h3> 274<ul> 275<li><a href="../commands/npm-help.html">npm help</a></li> 276<li><a href="../configuring-npm/package-json.html">package.json</a></li> 277<li><a href="../configuring-npm/npmrc.html">npmrc</a></li> 278<li><a href="../commands/npm-config.html">npm config</a></li> 279<li><a href="../commands/npm-install.html">npm install</a></li> 280<li><a href="../commands/npm-prefix.html">npm prefix</a></li> 281<li><a href="../commands/npm-publish.html">npm publish</a></li> 282</ul></div> 283 284<footer id="edit"> 285<a href="https://github.com/npm/cli/edit/latest/docs/content/commands/npm.md"> 286<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;"> 287<path fill-rule="evenodd" d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286 6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.249.249 0 00.108-.064l6.286-6.286z"></path> 288</svg> 289Edit this page on GitHub 290</a> 291</footer> 292</section> 293 294 295 296</body></html>