npm.1 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. .TH "NPM" "1" "October 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. 8\.1\.2
  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 variety of use cases\. Most
  21. commonly, you use it 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 comes preconfigured to use npm'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
  30. https://docs\.npmjs\.com/policies/terms\.
  31. .P
  32. You can configure npm to use any compatible registry you like, and even
  33. run your own registry\. Use of someone else's registry is governed by
  34. their terms of use\.
  35. .SS Introduction
  36. .P
  37. You probably got npm because you want to install stuff\.
  38. .P
  39. The very first thing you will most likely want to run in any node
  40. program is \fBnpm install\fP to install its dependencies\.
  41. .P
  42. You can also run \fBnpm install blerg\fP to install the latest version of
  43. "blerg"\. Check out npm help \fBinstall\fP for more
  44. info\. It can do a lot of stuff\.
  45. .P
  46. Use the \fBnpm search\fP command to show everything that's available in the
  47. public registry\. Use \fBnpm ls\fP to show everything you've installed\.
  48. .SS Dependencies
  49. .P
  50. If a package lists a dependency using a git URL, npm will install that
  51. dependency using the \fBgit\fP \fIhttps://github\.com/git\-guides/install\-git\fR
  52. command and will generate an error if it is not installed\.
  53. .P
  54. If one of the packages npm tries to install is a native node module and
  55. requires compiling of C++ Code, npm will use
  56. node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR for that task\.
  57. For a Unix system, node\-gyp \fIhttps://github\.com/nodejs/node\-gyp\fR
  58. needs Python, make and a buildchain like GCC\. On Windows,
  59. Python and Microsoft Visual Studio C++ are needed\. For more information
  60. visit the node\-gyp repository \fIhttps://github\.com/nodejs/node\-gyp\fR and
  61. the node\-gyp Wiki \fIhttps://github\.com/nodejs/node\-gyp/wiki\fR\|\.
  62. .SS Directories
  63. .P
  64. See npm help \fBfolders\fP to learn about where npm puts
  65. stuff\.
  66. .P
  67. In particular, npm has two modes of operation:
  68. .RS 0
  69. .IP \(bu 2
  70. local mode:
  71. npm installs packages into the current project directory, which
  72. defaults to the current working directory\. Packages install to
  73. \fB\|\./node_modules\fP, and bins to \fB\|\./node_modules/\.bin\fP\|\.
  74. .IP \(bu 2
  75. global mode:
  76. npm installs packages into the install prefix at
  77. \fB$npm_config_prefix/lib/node_modules\fP and bins to
  78. \fB$npm_config_prefix/bin\fP\|\.
  79. .RE
  80. .P
  81. Local mode is the default\. Use \fB\-g\fP or \fB\-\-global\fP on any command to
  82. run in global mode instead\.
  83. .SS Developer Usage
  84. .P
  85. If you're using npm to develop and publish your code, check out the
  86. following help topics:
  87. .RS 0
  88. .IP \(bu 2
  89. json:
  90. Make a package\.json file\. See
  91. npm help \fBpackage\.json\fP\|\.
  92. .IP \(bu 2
  93. link:
  94. Links your current working code into Node's path, so that you don't
  95. have to reinstall every time you make a change\. Use npm help \fBnpm
  96. link\fP to do this\.
  97. .IP \(bu 2
  98. install:
  99. It's a good idea to install things if you don't need the symbolic
  100. link\. Especially, installing other peoples code from the registry is
  101. done via npm help \fBinstall\fP
  102. .IP \(bu 2
  103. adduser:
  104. Create an account or log in\. When you do this, npm will store
  105. credentials in the user config file config file\.
  106. .IP \(bu 2
  107. publish:
  108. Use the npm help \fBpublish\fP command to upload your
  109. code to the registry\.
  110. .RE
  111. .SS Configuration
  112. .P
  113. npm is extremely configurable\. It reads its configuration options from
  114. 5 places\.
  115. .RS 0
  116. .IP \(bu 2
  117. Command line switches:
  118. Set a config with \fB\-\-key val\fP\|\. All keys take a value, even if they
  119. are booleans (the config parser doesn't know what the options are at
  120. the time of parsing)\. If you do not provide a value (\fB\-\-key\fP) then
  121. the option is set to boolean \fBtrue\fP\|\.
  122. .IP \(bu 2
  123. Environment Variables:
  124. Set any config by prefixing the name in an environment variable with
  125. \fBnpm_config_\fP\|\. For example, \fBexport npm_config_key=val\fP\|\.
  126. .IP \(bu 2
  127. User Configs:
  128. The file at \fB$HOME/\.npmrc\fP is an ini\-formatted list of configs\. If
  129. present, it is parsed\. If the \fBuserconfig\fP option is set in the cli
  130. or env, that file will be used instead\.
  131. .IP \(bu 2
  132. Global Configs:
  133. The file found at \fB\|\./etc/npmrc\fP (relative to the global prefix will be
  134. parsed if it is found\. See npm help \fBprefix\fP for
  135. more info on the global prefix\. If the \fBglobalconfig\fP option is set
  136. in the cli, env, or user config, then that file is parsed instead\.
  137. .IP \(bu 2
  138. Defaults:
  139. npm's default configuration options are defined in
  140. lib/utils/config\-defs\.js\. These must not be changed\.
  141. .RE
  142. .P
  143. See npm help \fBconfig\fP for much much more information\.
  144. .SS Contributions
  145. .P
  146. Patches welcome!
  147. .P
  148. If you would like to help, but don't know what to work on, read the
  149. contributing
  150. guidelines \fIhttps://github\.com/npm/cli/blob/latest/CONTRIBUTING\.md\fR and
  151. check the issues list\.
  152. .SS Bugs
  153. .P
  154. When you find issues, please report them:
  155. https://github\.com/npm/cli/issues
  156. .P
  157. Please be sure to follow the template and bug reporting guidelines\.
  158. .SS Feature Requests
  159. .P
  160. Discuss new feature ideas on our discussion forum:
  161. .RS 0
  162. .IP \(bu 2
  163. https://github\.com/npm/feedback
  164. .RE
  165. .P
  166. Or suggest formal RFC proposals:
  167. .RS 0
  168. .IP \(bu 2
  169. https://github\.com/npm/rfcs
  170. .RE
  171. .SS See Also
  172. .RS 0
  173. .IP \(bu 2
  174. npm help help
  175. .IP \(bu 2
  176. npm help package\.json
  177. .IP \(bu 2
  178. npm help npmrc
  179. .IP \(bu 2
  180. npm help config
  181. .IP \(bu 2
  182. npm help install
  183. .IP \(bu 2
  184. npm help prefix
  185. .IP \(bu 2
  186. npm help publish
  187. .RE