npm.html 12 KB

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