npm-install.1 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. .TH "NPM\-INSTALL" "1" "October 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-install\fR \- Install a package
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm install (with no args, in package dir)
  9. npm install [<@scope>/]<name>
  10. npm install [<@scope>/]<name>@<tag>
  11. npm install [<@scope>/]<name>@<version>
  12. npm install [<@scope>/]<name>@<version range>
  13. npm install <alias>@npm:<name>
  14. npm install <git\-host>:<git\-user>/<repo\-name>
  15. npm install <git repo url>
  16. npm install <tarball file>
  17. npm install <tarball url>
  18. npm install <folder>
  19. aliases: npm i, npm add
  20. common options: [\-P|\-\-save\-prod|\-D|\-\-save\-dev|\-O|\-\-save\-optional|\-\-save\-peer] [\-E|\-\-save\-exact] [\-B|\-\-save\-bundle] [\-\-no\-save] [\-\-dry\-run]
  21. .fi
  22. .RE
  23. .SS Description
  24. .P
  25. This command installs a package and any packages that it depends on\. If the
  26. package has a package\-lock, or an npm shrinkwrap file, or a yarn lock file,
  27. the installation of dependencies will be driven by that, respecting the
  28. following order of precedence:
  29. .RS 0
  30. .IP \(bu 2
  31. \fBnpm\-shrinkwrap\.json\fP
  32. .IP \(bu 2
  33. \fBpackage\-lock\.json\fP
  34. .IP \(bu 2
  35. \fByarn\.lock\fP
  36. .RE
  37. .P
  38. See npm help package\-lock\.json and
  39. npm help \fBshrinkwrap\fP\|\.
  40. .P
  41. A \fBpackage\fP is:
  42. .RS 0
  43. .IP \(bu 2
  44. a) a folder containing a program described by a
  45. npm help \fBpackage\.json\fP file
  46. .IP \(bu 2
  47. b) a gzipped tarball containing (a)
  48. .IP \(bu 2
  49. c) a url that resolves to (b)
  50. .IP \(bu 2
  51. d) a \fB<name>@<version>\fP that is published on the registry (see
  52. npm help \fBregistry\fP) with (c)
  53. .IP \(bu 2
  54. e) a \fB<name>@<tag>\fP (see npm help \fBdist\-tag\fP) that
  55. points to (d)
  56. .IP \(bu 2
  57. f) a \fB<name>\fP that has a "latest" tag satisfying (e)
  58. .IP \(bu 2
  59. g) a \fB<git remote url>\fP that resolves to (a)
  60. .RE
  61. .P
  62. Even if you never publish your package, you can still get a lot of benefits
  63. of using npm if you just want to write a node program (a), and perhaps if
  64. you also want to be able to easily install it elsewhere after packing it up
  65. into a tarball (b)\.
  66. .RS 0
  67. .IP \(bu 2
  68. \fBnpm install\fP (in a package directory, no arguments):
  69. Install the dependencies in the local \fBnode_modules\fP folder\.
  70. In global mode (ie, with \fB\-g\fP or \fB\-\-global\fP appended to the command),
  71. it installs the current package context (ie, the current working
  72. directory) as a global package\.
  73. By default, \fBnpm install\fP will install all modules listed as
  74. dependencies in npm help \fBpackage\.json\fP\|\.
  75. With the \fB\-\-production\fP flag (or when the \fBNODE_ENV\fP environment
  76. variable is set to \fBproduction\fP), npm will not install modules listed
  77. in \fBdevDependencies\fP\|\. To install all modules listed in both
  78. \fBdependencies\fP and \fBdevDependencies\fP when \fBNODE_ENV\fP environment
  79. variable is set to \fBproduction\fP, you can use \fB\-\-production=false\fP\|\.
  80. .QP
  81. NOTE: The \fB\-\-production\fP flag has no particular meaning when adding a
  82. dependency to a project\.
  83. .
  84. .IP \(bu 2
  85. \fBnpm install <folder>\fP:
  86. Install the package in the directory as a symlink in the current
  87. project\. Its dependencies will be installed before it's linked\. If
  88. \fB<folder>\fP sits inside the root of your project, its dependencies may
  89. be hoisted to the top\-level \fBnode_modules\fP as they would for other
  90. types of dependencies\.
  91. .IP \(bu 2
  92. \fBnpm install <tarball file>\fP:
  93. Install a package that is sitting on the filesystem\. Note: if you just
  94. want to link a dev directory into your npm root, you can do this more
  95. easily by using npm help \fBlink\fP\|\.
  96. Tarball requirements:
  97. .RS
  98. .IP \(bu 2
  99. The filename \fImust\fR use \fB\|\.tar\fP, \fB\|\.tar\.gz\fP, or \fB\|\.tgz\fP as the
  100. extension\.
  101. .IP \(bu 2
  102. The package contents should reside in a subfolder inside the tarball
  103. (usually it is called \fBpackage/\fP)\. npm strips one directory layer
  104. when installing the package (an equivalent of \fBtar x
  105. \-\-strip\-components=1\fP is run)\.
  106. .IP \(bu 2
  107. The package must contain a \fBpackage\.json\fP file with \fBname\fP and
  108. \fBversion\fP properties\.
  109. Example:
  110. .P
  111. .RS 2
  112. .nf
  113. npm install \./package\.tgz
  114. .fi
  115. .RE
  116. .RE
  117. .IP \(bu 2
  118. \fBnpm install <tarball url>\fP:
  119. Fetch the tarball url, and then install it\. In order to distinguish between
  120. this and other options, the argument must start with "http://" or "https://"
  121. Example:
  122. .P
  123. .RS 2
  124. .nf
  125. npm install https://github\.com/indexzero/forever/tarball/v0\.5\.6
  126. .fi
  127. .RE
  128. .IP \(bu 2
  129. \fBnpm install [<@scope>/]<name>\fP:
  130. Do a \fB<name>@<tag>\fP install, where \fB<tag>\fP is the "tag" config\. (See
  131. npm help \fBconfig\fP\|\. The config's default value is \fBlatest\fP\|\.)
  132. In most cases, this will install the version of the modules tagged as
  133. \fBlatest\fP on the npm registry\.
  134. Example:
  135. .P
  136. .RS 2
  137. .nf
  138. npm install sax
  139. .fi
  140. .RE
  141. \fBnpm install\fP saves any specified packages into \fBdependencies\fP by default\.
  142. Additionally, you can control where and how they get saved with some
  143. additional flags:
  144. .RS
  145. .IP \(bu 2
  146. \fB\-P, \-\-save\-prod\fP: Package will appear in your \fBdependencies\fP\|\. This
  147. is the default unless \fB\-D\fP or \fB\-O\fP are present\.
  148. .IP \(bu 2
  149. \fB\-D, \-\-save\-dev\fP: Package will appear in your \fBdevDependencies\fP\|\.
  150. .IP \(bu 2
  151. \fB\-O, \-\-save\-optional\fP: Package will appear in your
  152. \fBoptionalDependencies\fP\|\.
  153. .IP \(bu 2
  154. \fB\-\-no\-save\fP: Prevents saving to \fBdependencies\fP\|\.
  155. When using any of the above options to save dependencies to your
  156. package\.json, there are two additional, optional flags:
  157. .IP \(bu 2
  158. \fB\-E, \-\-save\-exact\fP: Saved dependencies will be configured with an
  159. exact version rather than using npm's default semver range operator\.
  160. .IP \(bu 2
  161. \fB\-B, \-\-save\-bundle\fP: Saved dependencies will also be added to your
  162. \fBbundleDependencies\fP list\.
  163. Further, if you have an \fBnpm\-shrinkwrap\.json\fP or \fBpackage\-lock\.json\fP
  164. then it will be updated as well\.
  165. \fB<scope>\fP is optional\. The package will be downloaded from the registry
  166. associated with the specified scope\. If no registry is associated with
  167. the given scope the default registry is assumed\. See
  168. npm help \fBscope\fP\|\.
  169. Note: if you do not include the @\-symbol on your scope name, npm will
  170. interpret this as a GitHub repository instead, see below\. Scopes names
  171. must also be followed by a slash\.
  172. Examples:
  173. .P
  174. .RS 2
  175. .nf
  176. npm install sax
  177. npm install githubname/reponame
  178. npm install @myorg/privatepackage
  179. npm install node\-tap \-\-save\-dev
  180. npm install dtrace\-provider \-\-save\-optional
  181. npm install readable\-stream \-\-save\-exact
  182. npm install ansi\-regex \-\-save\-bundle
  183. .fi
  184. .RE
  185. .IP \(bu 2
  186. \fINote*\fR: If there is a file or folder named \fB<name>\fP in the current
  187. working directory, then it will try to install that, and only try to
  188. fetch the package by name if it is not valid\.
  189. .RE
  190. .IP \(bu 2
  191. \fBnpm install <alias>@npm:<name>\fP:
  192. Install a package under a custom alias\. Allows multiple versions of
  193. a same\-name package side\-by\-side, more convenient import names for
  194. packages with otherwise long ones, and using git forks replacements
  195. or forked npm packages as replacements\. Aliasing works only on your
  196. project and does not rename packages in transitive dependencies\.
  197. Aliases should follow the naming conventions stated in
  198. \fBvalidate\-npm\-package\-name\fP \fIhttps://www\.npmjs\.com/package/validate\-npm\-package\-name#naming\-rules\fR\|\.
  199. Examples:
  200. .P
  201. .RS 2
  202. .nf
  203. npm install my\-react@npm:react
  204. npm install jquery2@npm:jquery@2
  205. npm install jquery3@npm:jquery@3
  206. npm install npa@npm:npm\-package\-arg
  207. .fi
  208. .RE
  209. .IP \(bu 2
  210. \fBnpm install [<@scope>/]<name>@<tag>\fP:
  211. Install the version of the package that is referenced by the specified tag\.
  212. If the tag does not exist in the registry data for that package, then this
  213. will fail\.
  214. Example:
  215. .P
  216. .RS 2
  217. .nf
  218. npm install sax@latest
  219. npm install @myorg/mypackage@latest
  220. .fi
  221. .RE
  222. .IP \(bu 2
  223. \fBnpm install [<@scope>/]<name>@<version>\fP:
  224. Install the specified version of the package\. This will fail if the
  225. version has not been published to the registry\.
  226. Example:
  227. .P
  228. .RS 2
  229. .nf
  230. npm install sax@0\.1\.1
  231. npm install @myorg/privatepackage@1\.5\.0
  232. .fi
  233. .RE
  234. .IP \(bu 2
  235. \fBnpm install [<@scope>/]<name>@<version range>\fP:
  236. Install a version of the package matching the specified version range\.
  237. This will follow the same rules for resolving dependencies described in
  238. npm help \fBpackage\.json\fP\|\.
  239. Note that most version ranges must be put in quotes so that your shell
  240. will treat it as a single argument\.
  241. Example:
  242. .P
  243. .RS 2
  244. .nf
  245. npm install sax@">=0\.1\.0 <0\.2\.0"
  246. npm install @myorg/privatepackage@"16 \- 17"
  247. .fi
  248. .RE
  249. .IP \(bu 2
  250. \fBnpm install <git remote url>\fP:
  251. Installs the package from the hosted git provider, cloning it with
  252. \fBgit\fP\|\. For a full git remote url, only that URL will be attempted\.
  253. .P
  254. .RS 2
  255. .nf
  256. <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit\-ish> | #semver:<semver>]
  257. .fi
  258. .RE
  259. \fB<protocol>\fP is one of \fBgit\fP, \fBgit+ssh\fP, \fBgit+http\fP, \fBgit+https\fP, or
  260. \fBgit+file\fP\|\.
  261. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  262. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP
  263. can be any valid semver range or exact version, and npm will look for
  264. any tags or refs matching that range in the remote repository, much as
  265. it would for a registry dependency\. If neither \fB#<commit\-ish>\fP or
  266. \fB#semver:<semver>\fP is specified, then the default branch of the
  267. repository is used\.
  268. If the repository makes use of submodules, those submodules will be
  269. cloned as well\.
  270. If the package being installed contains a \fBprepare\fP script, its
  271. \fBdependencies\fP and \fBdevDependencies\fP will be installed, and the prepare
  272. script will be run, before the package is packaged and installed\.
  273. The following git environment variables are recognized by npm and will
  274. be added to the environment when running git:
  275. .RS
  276. .IP \(bu 2
  277. \fBGIT_ASKPASS\fP
  278. .IP \(bu 2
  279. \fBGIT_EXEC_PATH\fP
  280. .IP \(bu 2
  281. \fBGIT_PROXY_COMMAND\fP
  282. .IP \(bu 2
  283. \fBGIT_SSH\fP
  284. .IP \(bu 2
  285. \fBGIT_SSH_COMMAND\fP
  286. .IP \(bu 2
  287. \fBGIT_SSL_CAINFO\fP
  288. .IP \(bu 2
  289. \fBGIT_SSL_NO_VERIFY\fP
  290. See the git man page for details\.
  291. Examples:
  292. .P
  293. .RS 2
  294. .nf
  295. npm install git+ssh://git@github\.com:npm/cli\.git#v1\.0\.27
  296. npm install git+ssh://git@github\.com:npm/cli#pull/273
  297. npm install git+ssh://git@github\.com:npm/cli#semver:^5\.0
  298. npm install git+https://isaacs@github\.com/npm/cli\.git
  299. npm install git://github\.com/npm/cli\.git#v1\.0\.27
  300. GIT_SSH_COMMAND='ssh \-i ~/\.ssh/custom_ident' npm install git+ssh://git@github\.com:npm/cli\.git
  301. .fi
  302. .RE
  303. .RE
  304. .IP \(bu 2
  305. \fBnpm install <githubname>/<githubrepo>[#<commit\-ish>]\fP:
  306. .IP \(bu 2
  307. \fBnpm install github:<githubname>/<githubrepo>[#<commit\-ish>]\fP:
  308. Install the package at \fBhttps://github\.com/githubname/githubrepo\fP by
  309. attempting to clone it using \fBgit\fP\|\.
  310. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  311. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP
  312. can be any valid semver range or exact version, and npm will look for
  313. any tags or refs matching that range in the remote repository, much as
  314. it would for a registry dependency\. If neither \fB#<commit\-ish>\fP or
  315. \fB#semver:<semver>\fP is specified, then \fBmaster\fP is used\.
  316. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP
  317. will be installed if the package has a \fBprepare\fP script before the
  318. package is done installing\.
  319. Examples:
  320. .P
  321. .RS 2
  322. .nf
  323. npm install mygithubuser/myproject
  324. npm install github:mygithubuser/myproject
  325. .fi
  326. .RE
  327. .IP \(bu 2
  328. \fBnpm install gist:[<githubname>/]<gistID>[#<commit\-ish>|#semver:<semver>]\fP:
  329. Install the package at \fBhttps://gist\.github\.com/gistID\fP by attempting to
  330. clone it using \fBgit\fP\|\. The GitHub username associated with the gist is
  331. optional and will not be saved in \fBpackage\.json\fP\|\.
  332. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP will
  333. be installed if the package has a \fBprepare\fP script before the package is
  334. done installing\.
  335. Example:
  336. .P
  337. .RS 2
  338. .nf
  339. npm install gist:101a11beef
  340. .fi
  341. .RE
  342. .IP \(bu 2
  343. \fBnpm install bitbucket:<bitbucketname>/<bitbucketrepo>[#<commit\-ish>]\fP:
  344. Install the package at \fBhttps://bitbucket\.org/bitbucketname/bitbucketrepo\fP
  345. by attempting to clone it using \fBgit\fP\|\.
  346. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  347. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP can
  348. be any valid semver range or exact version, and npm will look for any tags
  349. or refs matching that range in the remote repository, much as it would for a
  350. registry dependency\. If neither \fB#<commit\-ish>\fP or \fB#semver:<semver>\fP is
  351. specified, then \fBmaster\fP is used\.
  352. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP will
  353. be installed if the package has a \fBprepare\fP script before the package is
  354. done installing\.
  355. Example:
  356. .P
  357. .RS 2
  358. .nf
  359. npm install bitbucket:mybitbucketuser/myproject
  360. .fi
  361. .RE
  362. .IP \(bu 2
  363. \fBnpm install gitlab:<gitlabname>/<gitlabrepo>[#<commit\-ish>]\fP:
  364. Install the package at \fBhttps://gitlab\.com/gitlabname/gitlabrepo\fP
  365. by attempting to clone it using \fBgit\fP\|\.
  366. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  367. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP can
  368. be any valid semver range or exact version, and npm will look for any tags
  369. or refs matching that range in the remote repository, much as it would for a
  370. registry dependency\. If neither \fB#<commit\-ish>\fP or \fB#semver:<semver>\fP is
  371. specified, then \fBmaster\fP is used\.
  372. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP will
  373. be installed if the package has a \fBprepare\fP script before the package is
  374. done installing\.
  375. Example:
  376. .P
  377. .RS 2
  378. .nf
  379. npm install gitlab:mygitlabuser/myproject
  380. npm install gitlab:myusr/myproj#semver:^5\.0
  381. .fi
  382. .RE
  383. .RE
  384. .P
  385. You may combine multiple arguments and even multiple types of arguments\.
  386. For example:
  387. .P
  388. .RS 2
  389. .nf
  390. npm install sax@">=0\.1\.0 <0\.2\.0" bench supervisor
  391. .fi
  392. .RE
  393. .P
  394. The \fB\-\-tag\fP argument will apply to all of the specified install targets\. If
  395. a tag with the given name exists, the tagged version is preferred over
  396. newer versions\.
  397. .P
  398. The \fB\-\-dry\-run\fP argument will report in the usual way what the install
  399. would have done without actually installing anything\.
  400. .P
  401. The \fB\-\-package\-lock\-only\fP argument will only update the
  402. \fBpackage\-lock\.json\fP, instead of checking \fBnode_modules\fP and downloading
  403. dependencies\.
  404. .P
  405. The \fB\-f\fP or \fB\-\-force\fP argument will force npm to fetch remote resources
  406. even if a local copy exists on disk\.
  407. .P
  408. .RS 2
  409. .nf
  410. npm install sax \-\-force
  411. .fi
  412. .RE
  413. .SS Configuration
  414. .P
  415. See the npm help \fBconfig\fP help doc\. Many of the configuration
  416. params have some effect on installation, since that's most of what npm
  417. does\.
  418. .P
  419. These are some of the most common options related to installation\.
  420. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  421. <!\-\- automatically generated, do not edit manually \-\->
  422. <!\-\- see lib/utils/config/definitions\.js \-\->
  423. .SS \fBsave\fP
  424. .RS 0
  425. .IP \(bu 2
  426. Default: true
  427. .IP \(bu 2
  428. Type: Boolean
  429. .RE
  430. .P
  431. Save installed packages to a package\.json file as dependencies\.
  432. .P
  433. When used with the \fBnpm rm\fP command, removes the dependency from
  434. package\.json\.
  435. <!\-\- automatically generated, do not edit manually \-\->
  436. <!\-\- see lib/utils/config/definitions\.js \-\->
  437. .SS \fBsave\-exact\fP
  438. .RS 0
  439. .IP \(bu 2
  440. Default: false
  441. .IP \(bu 2
  442. Type: Boolean
  443. .RE
  444. .P
  445. Dependencies saved to package\.json will be configured with an exact version
  446. rather than using npm's default semver range operator\.
  447. <!\-\- automatically generated, do not edit manually \-\->
  448. <!\-\- see lib/utils/config/definitions\.js \-\->
  449. .SS \fBglobal\fP
  450. .RS 0
  451. .IP \(bu 2
  452. Default: false
  453. .IP \(bu 2
  454. Type: Boolean
  455. .RE
  456. .P
  457. Operates in "global" mode, so that packages are installed into the \fBprefix\fP
  458. folder instead of the current working directory\. See
  459. npm help folders for more on the differences in behavior\.
  460. .RS 0
  461. .IP \(bu 2
  462. packages are installed into the \fB{prefix}/lib/node_modules\fP folder, instead
  463. of the current working directory\.
  464. .IP \(bu 2
  465. bin files are linked to \fB{prefix}/bin\fP
  466. .IP \(bu 2
  467. man pages are linked to \fB{prefix}/share/man\fP
  468. .RE
  469. <!\-\- automatically generated, do not edit manually \-\->
  470. <!\-\- see lib/utils/config/definitions\.js \-\->
  471. .SS \fBglobal\-style\fP
  472. .RS 0
  473. .IP \(bu 2
  474. Default: false
  475. .IP \(bu 2
  476. Type: Boolean
  477. .RE
  478. .P
  479. Causes npm to install the package into your local \fBnode_modules\fP folder with
  480. the same layout it uses with the global \fBnode_modules\fP folder\. Only your
  481. direct dependencies will show in \fBnode_modules\fP and everything they depend
  482. on will be flattened in their \fBnode_modules\fP folders\. This obviously will
  483. eliminate some deduping\. If used with \fBlegacy\-bundling\fP, \fBlegacy\-bundling\fP
  484. will be preferred\.
  485. <!\-\- automatically generated, do not edit manually \-\->
  486. <!\-\- see lib/utils/config/definitions\.js \-\->
  487. .SS \fBlegacy\-bundling\fP
  488. .RS 0
  489. .IP \(bu 2
  490. Default: false
  491. .IP \(bu 2
  492. Type: Boolean
  493. .RE
  494. .P
  495. Causes npm to install the package such that versions of npm prior to 1\.4,
  496. such as the one included with node 0\.8, can install the package\. This
  497. eliminates all automatic deduping\. If used with \fBglobal\-style\fP this option
  498. will be preferred\.
  499. <!\-\- automatically generated, do not edit manually \-\->
  500. <!\-\- see lib/utils/config/definitions\.js \-\->
  501. .SS \fBstrict\-peer\-deps\fP
  502. .RS 0
  503. .IP \(bu 2
  504. Default: false
  505. .IP \(bu 2
  506. Type: Boolean
  507. .RE
  508. .P
  509. If set to \fBtrue\fP, and \fB\-\-legacy\-peer\-deps\fP is not set, then \fIany\fR
  510. conflicting \fBpeerDependencies\fP will be treated as an install failure, even
  511. if npm could reasonably guess the appropriate resolution based on non\-peer
  512. dependency relationships\.
  513. .P
  514. By default, conflicting \fBpeerDependencies\fP deep in the dependency graph will
  515. be resolved using the nearest non\-peer dependency specification, even if
  516. doing so will result in some packages receiving a peer dependency outside
  517. the range set in their package's \fBpeerDependencies\fP object\.
  518. .P
  519. When such and override is performed, a warning is printed, explaining the
  520. conflict and the packages involved\. If \fB\-\-strict\-peer\-deps\fP is set, then
  521. this warning is treated as a failure\.
  522. <!\-\- automatically generated, do not edit manually \-\->
  523. <!\-\- see lib/utils/config/definitions\.js \-\->
  524. .SS \fBpackage\-lock\fP
  525. .RS 0
  526. .IP \(bu 2
  527. Default: true
  528. .IP \(bu 2
  529. Type: Boolean
  530. .RE
  531. .P
  532. If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This
  533. will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\.
  534. .P
  535. When package package\-locks are disabled, automatic pruning of extraneous
  536. modules will also be disabled\. To remove extraneous modules with
  537. package\-locks disabled use \fBnpm prune\fP\|\.
  538. <!\-\- automatically generated, do not edit manually \-\->
  539. <!\-\- see lib/utils/config/definitions\.js \-\->
  540. .SS \fBomit\fP
  541. .RS 0
  542. .IP \(bu 2
  543. Default: 'dev' if the \fBNODE_ENV\fP environment variable is set to
  544. \|'production', otherwise empty\.
  545. .IP \(bu 2
  546. Type: "dev", "optional", or "peer" (can be set multiple times)
  547. .RE
  548. .P
  549. Dependency types to omit from the installation tree on disk\.
  550. .P
  551. Note that these dependencies \fIare\fR still resolved and added to the
  552. \fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP file\. They are just not
  553. physically installed on disk\.
  554. .P
  555. If a package type appears in both the \fB\-\-include\fP and \fB\-\-omit\fP lists, then
  556. it will be included\.
  557. .P
  558. If the resulting omit list includes \fB\|'dev'\fP, then the \fBNODE_ENV\fP environment
  559. variable will be set to \fB\|'production'\fP for all lifecycle scripts\.
  560. <!\-\- automatically generated, do not edit manually \-\->
  561. <!\-\- see lib/utils/config/definitions\.js \-\->
  562. .SS \fBignore\-scripts\fP
  563. .RS 0
  564. .IP \(bu 2
  565. Default: false
  566. .IP \(bu 2
  567. Type: Boolean
  568. .RE
  569. .P
  570. If true, npm does not run scripts specified in package\.json files\.
  571. .P
  572. Note that commands explicitly intended to run a particular script, such as
  573. \fBnpm start\fP, \fBnpm stop\fP, \fBnpm restart\fP, \fBnpm test\fP, and \fBnpm run\-script\fP
  574. will still run their intended script if \fBignore\-scripts\fP is set, but they
  575. will \fInot\fR run any pre\- or post\-scripts\.
  576. <!\-\- automatically generated, do not edit manually \-\->
  577. <!\-\- see lib/utils/config/definitions\.js \-\->
  578. .SS \fBaudit\fP
  579. .RS 0
  580. .IP \(bu 2
  581. Default: true
  582. .IP \(bu 2
  583. Type: Boolean
  584. .RE
  585. .P
  586. When "true" submit audit reports alongside the current npm command to the
  587. default registry and all registries configured for scopes\. See the
  588. documentation for npm help \fBaudit\fP for details on what is
  589. submitted\.
  590. <!\-\- automatically generated, do not edit manually \-\->
  591. <!\-\- see lib/utils/config/definitions\.js \-\->
  592. .SS \fBbin\-links\fP
  593. .RS 0
  594. .IP \(bu 2
  595. Default: true
  596. .IP \(bu 2
  597. Type: Boolean
  598. .RE
  599. .P
  600. Tells npm to create symlinks (or \fB\|\.cmd\fP shims on Windows) for package
  601. executables\.
  602. .P
  603. Set to false to have it not do this\. This can be used to work around the
  604. fact that some file systems don't support symlinks, even on ostensibly Unix
  605. systems\.
  606. <!\-\- automatically generated, do not edit manually \-\->
  607. <!\-\- see lib/utils/config/definitions\.js \-\->
  608. .SS \fBfund\fP
  609. .RS 0
  610. .IP \(bu 2
  611. Default: true
  612. .IP \(bu 2
  613. Type: Boolean
  614. .RE
  615. .P
  616. When "true" displays the message at the end of each \fBnpm install\fP
  617. acknowledging the number of dependencies looking for funding\. See npm help \fBnpm
  618. fund\fP for details\.
  619. <!\-\- automatically generated, do not edit manually \-\->
  620. <!\-\- see lib/utils/config/definitions\.js \-\->
  621. .SS \fBdry\-run\fP
  622. .RS 0
  623. .IP \(bu 2
  624. Default: false
  625. .IP \(bu 2
  626. Type: Boolean
  627. .RE
  628. .P
  629. Indicates that you don't want npm to make any changes and that it should
  630. only report what it would have done\. This can be passed into any of the
  631. commands that modify your local installation, eg, \fBinstall\fP, \fBupdate\fP,
  632. \fBdedupe\fP, \fBuninstall\fP, as well as \fBpack\fP and \fBpublish\fP\|\.
  633. .P
  634. Note: This is NOT honored by other network related commands, eg \fBdist\-tags\fP,
  635. \fBowner\fP, etc\.
  636. <!\-\- automatically generated, do not edit manually \-\->
  637. <!\-\- see lib/utils/config/definitions\.js \-\->
  638. .SS \fBworkspace\fP
  639. .RS 0
  640. .IP \(bu 2
  641. Default:
  642. .IP \(bu 2
  643. Type: String (can be set multiple times)
  644. .RE
  645. .P
  646. Enable running a command in the context of the configured workspaces of the
  647. current project while filtering by running only the workspaces defined by
  648. this configuration option\.
  649. .P
  650. Valid values for the \fBworkspace\fP config are either:
  651. .RS 0
  652. .IP \(bu 2
  653. Workspace names
  654. .IP \(bu 2
  655. Path to a workspace directory
  656. .IP \(bu 2
  657. Path to a parent workspace directory (will result in selecting all
  658. workspaces within that folder)
  659. .RE
  660. .P
  661. When set for the \fBnpm init\fP command, this may be set to the folder of a
  662. workspace which does not yet exist, to create the folder and set it up as a
  663. brand new workspace within the project\.
  664. .P
  665. This value is not exported to the environment for child processes\.
  666. <!\-\- automatically generated, do not edit manually \-\->
  667. <!\-\- see lib/utils/config/definitions\.js \-\->
  668. .SS \fBworkspaces\fP
  669. .RS 0
  670. .IP \(bu 2
  671. Default: null
  672. .IP \(bu 2
  673. Type: null or Boolean
  674. .RE
  675. .P
  676. Set to true to run the command in the context of \fBall\fR configured
  677. workspaces\.
  678. .P
  679. Explicitly setting this to false will cause commands like \fBinstall\fP to
  680. ignore workspaces altogether\. When not set explicitly:
  681. .RS 0
  682. .IP \(bu 2
  683. Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.)
  684. will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do
  685. other things (test, exec, publish, etc\.) will operate on the root project,
  686. \fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\.
  687. .RE
  688. .P
  689. This value is not exported to the environment for child processes\.
  690. <!\-\- automatically generated, do not edit manually \-\->
  691. <!\-\- see lib/utils/config/definitions\.js \-\->
  692. .SS \fBinclude\-workspace\-root\fP
  693. .RS 0
  694. .IP \(bu 2
  695. Default: false
  696. .IP \(bu 2
  697. Type: Boolean
  698. .RE
  699. .P
  700. Include the workspace root when workspaces are enabled for a command\.
  701. .P
  702. When false, specifying individual workspaces via the \fBworkspace\fP config, or
  703. all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
  704. the specified workspaces, and not on the root project\.
  705. <!\-\- automatically generated, do not edit manually \-\->
  706. <!\-\- see lib/utils/config/definitions\.js \-\->
  707. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  708. .SS Algorithm
  709. .P
  710. Given a \fBpackage{dep}\fP structure: \fBA{B,C}, B{C}, C{D}\fP,
  711. the npm install algorithm produces:
  712. .P
  713. .RS 2
  714. .nf
  715. A
  716. +\-\- B
  717. +\-\- C
  718. +\-\- D
  719. .fi
  720. .RE
  721. .P
  722. That is, the dependency from B to C is satisfied by the fact that A already
  723. caused C to be installed at a higher level\. D is still installed at the top
  724. level because nothing conflicts with it\.
  725. .P
  726. For \fBA{B,C}, B{C,D@1}, C{D@2}\fP, this algorithm produces:
  727. .P
  728. .RS 2
  729. .nf
  730. A
  731. +\-\- B
  732. +\-\- C
  733. `\-\- D@2
  734. +\-\- D@1
  735. .fi
  736. .RE
  737. .P
  738. Because B's D@1 will be installed in the top\-level, C now has to install
  739. D@2 privately for itself\. This algorithm is deterministic, but different
  740. trees may be produced if two dependencies are requested for installation in
  741. a different order\.
  742. .P
  743. See npm help folders for a more detailed description of
  744. the specific folder structures that npm creates\.
  745. .SS See Also
  746. .RS 0
  747. .IP \(bu 2
  748. npm help folders
  749. .IP \(bu 2
  750. npm help update
  751. .IP \(bu 2
  752. npm help audit
  753. .IP \(bu 2
  754. npm help fund
  755. .IP \(bu 2
  756. npm help link
  757. .IP \(bu 2
  758. npm help rebuild
  759. .IP \(bu 2
  760. npm help scripts
  761. .IP \(bu 2
  762. npm help config
  763. .IP \(bu 2
  764. npm help npmrc
  765. .IP \(bu 2
  766. npm help registry
  767. .IP \(bu 2
  768. npm help dist\-tag
  769. .IP \(bu 2
  770. npm help uninstall
  771. .IP \(bu 2
  772. npm help shrinkwrap
  773. .IP \(bu 2
  774. npm help package\.json
  775. .IP \(bu 2
  776. npm help workspaces
  777. .RE