npm.1 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. .TH "NPM" "1" "August 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm\fR \- javascript package manager
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm <command> [args]
  9. .fi
  10. .RE
  11. .SS Version
  12. .P
  13. 6\.14\.15
  14. .SS Description
  15. .P
  16. npm is the package manager for the Node JavaScript platform\. It puts
  17. modules in place so that node can find them, and manages dependency
  18. conflicts intelligently\.
  19. .P
  20. It is extremely configurable to support a wide variety of use cases\.
  21. Most commonly, it is used to publish, discover, install, and develop node
  22. programs\.
  23. .P
  24. Run \fBnpm help\fP to get a list of available commands\.
  25. .SS Important
  26. .P
  27. npm is configured to use npm, Inc\.'s public registry at
  28. https://registry\.npmjs\.org by default\. Use of the npm public registry is
  29. subject to terms of use available at https://www\.npmjs\.com/policies/terms\.
  30. .P
  31. You can configure npm to use any compatible registry you like, and even run
  32. your own registry\. Use of someone else's registry may be governed by their
  33. terms of use\.
  34. .SS Introduction
  35. .P
  36. You probably got npm because you want to install stuff\.
  37. .P
  38. Use \fBnpm install blerg\fP to install the latest version of "blerg"\. Check out
  39. npm help \fBinstall\fP for more info\. It can do a lot of stuff\.
  40. .P
  41. Use the \fBnpm search\fP command to show everything that's available\.
  42. Use \fBnpm ls\fP to show everything you've installed\.
  43. .SS Dependencies
  44. .P
  45. If a package references to another package with a git URL, npm depends
  46. on a preinstalled git\.
  47. .P
  48. If one of the packages npm tries to install is a native node module and
  49. requires compiling of C++ Code, npm will use
  50. node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR for that task\.
  51. For a Unix system, node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR
  52. needs Python, make and a buildchain like GCC\. On Windows,
  53. Python and Microsoft Visual Studio C++ are needed\.
  54. For more information visit
  55. the node\-gyp repository \fIhttps://github\.com/nodejs/node\-gyp\fR and
  56. the node\-gyp Wiki \fIhttps://github\.com/nodejs/node\-gyp/wiki\fR\|\.
  57. .SS Directories
  58. .P
  59. See npm help \fBfolders\fP to learn about where npm puts stuff\.
  60. .P
  61. In particular, npm has two modes of operation:
  62. .RS 0
  63. .IP \(bu 2
  64. global mode:
  65. npm installs packages into the install prefix at
  66. \fBprefix/lib/node_modules\fP and bins are installed in \fBprefix/bin\fP\|\.
  67. .IP \(bu 2
  68. local mode:
  69. npm installs packages into the current project directory, which
  70. defaults to the current working directory\. Packages are installed to
  71. \fB\|\./node_modules\fP, and bins are installed to \fB\|\./node_modules/\.bin\fP\|\.
  72. .RE
  73. .P
  74. Local mode is the default\. Use \fB\-g\fP or \fB\-\-global\fP on any command to
  75. operate in global mode instead\.
  76. .SS Developer Usage
  77. .P
  78. If you're using npm to develop and publish your code, check out the
  79. following help topics:
  80. .RS 0
  81. .IP \(bu 2
  82. json:
  83. Make a package\.json file\. See npm help \fBpackage\.json\fP\|\.
  84. .IP \(bu 2
  85. link:
  86. For linking your current working code into Node's path, so that you
  87. don't have to reinstall every time you make a change\. Use
  88. \fBnpm link\fP to do this\.
  89. .IP \(bu 2
  90. install:
  91. It's a good idea to install things if you don't need the symbolic link\.
  92. Especially, installing other peoples code from the registry is done via
  93. \fBnpm install\fP
  94. .IP \(bu 2
  95. adduser:
  96. Create an account or log in\. Credentials are stored in the
  97. user config file\.
  98. .IP \(bu 2
  99. publish:
  100. Use the \fBnpm publish\fP command to upload your code to the registry\.
  101. .RE
  102. .SS Configuration
  103. .P
  104. npm is extremely configurable\. It reads its configuration options from
  105. 5 places\.
  106. .RS 0
  107. .IP \(bu 2
  108. Command line switches:
  109. Set a config with \fB\-\-key val\fP\|\. All keys take a value, even if they
  110. are booleans (the config parser doesn't know what the options are at
  111. the time of parsing)\. If no value is provided, then the option is set
  112. to boolean \fBtrue\fP\|\.
  113. .IP \(bu 2
  114. Environment Variables:
  115. Set any config by prefixing the name in an environment variable with
  116. \fBnpm_config_\fP\|\. For example, \fBexport npm_config_key=val\fP\|\.
  117. .IP \(bu 2
  118. User Configs:
  119. The file at $HOME/\.npmrc is an ini\-formatted list of configs\. If
  120. present, it is parsed\. If the \fBuserconfig\fP option is set in the cli
  121. or env, then that will be used instead\.
  122. .IP \(bu 2
  123. Global Configs:
  124. The file found at \.\./etc/npmrc (from the node executable, by default
  125. this resolves to /usr/local/etc/npmrc) will be parsed if it is found\.
  126. If the \fBglobalconfig\fP option is set in the cli, env, or user config,
  127. then that file is parsed instead\.
  128. .IP \(bu 2
  129. Defaults:
  130. npm's default configuration options are defined in
  131. lib/utils/config\-defs\.js\. These must not be changed\.
  132. .RE
  133. .P
  134. See npm help \fBconfig\fP for much much more information\.
  135. .SS Contributions
  136. .P
  137. Patches welcome!
  138. .P
  139. If you would like to contribute, but don't know what to work on, read
  140. the contributing guidelines and check the issues list\.
  141. .RS 0
  142. .IP \(bu 2
  143. CONTRIBUTING\.md \fIhttps://github\.com/npm/cli/blob/latest/CONTRIBUTING\.md\fR
  144. .IP \(bu 2
  145. Bug tracker \fIhttps://github\.com/npm/cli/issues\fR
  146. .RE
  147. .SS Bugs
  148. .P
  149. When you find issues, please report them:
  150. .RS 0
  151. .IP \(bu 2
  152. web:
  153. https://npm\.community/c/bugs
  154. .RE
  155. .P
  156. Be sure to follow the template and bug reporting guidelines\. You can also ask
  157. for help in the support forum \fIhttps://npm\.community/c/support\fR if you're
  158. unsure if it's actually a bug or are having trouble coming up with a detailed
  159. reproduction to report\.
  160. .SS Author
  161. .P
  162. Isaac Z\. Schlueter \fIhttp://blog\.izs\.me/\fR ::
  163. isaacs \fIhttps://github\.com/isaacs/\fR ::
  164. @izs \fIhttps://twitter\.com/izs\fR ::
  165. i@izs\.me
  166. .SS See Also
  167. .RS 0
  168. .IP \(bu 2
  169. npm help help
  170. .IP \(bu 2
  171. npm help package\.json
  172. .IP \(bu 2
  173. npm help install
  174. .IP \(bu 2
  175. npm help config
  176. .IP \(bu 2
  177. npm help npmrc
  178. .RE