npm-install.1 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. .TH "NPM\-INSTALL" "1" "August 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] [\-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 shrinkwrap file, the installation of dependencies
  27. will be driven by that, with an \fBnpm\-shrinkwrap\.json\fP taking precedence if both
  28. files exist\. See npm help package\-lock\.json and npm help \fBshrinkwrap\fP\|\.
  29. .P
  30. A \fBpackage\fP is:
  31. .RS 0
  32. .IP \(bu 2
  33. a) a folder containing a program described by a npm help \fBpackage\.json\fP file
  34. .IP \(bu 2
  35. b) a gzipped tarball containing (a)
  36. .IP \(bu 2
  37. c) a url that resolves to (b)
  38. .IP \(bu 2
  39. d) a \fB<name>@<version>\fP that is published on the registry (see npm help \fBregistry\fP) with (c)
  40. .IP \(bu 2
  41. e) a \fB<name>@<tag>\fP (see npm help \fBdist\-tag\fP) that points to (d)
  42. .IP \(bu 2
  43. f) a \fB<name>\fP that has a "latest" tag satisfying (e)
  44. .IP \(bu 2
  45. g) a \fB<git remote url>\fP that resolves to (a)
  46. .RE
  47. .P
  48. Even if you never publish your package, you can still get a lot of
  49. benefits of using npm if you just want to write a node program (a), and
  50. perhaps if you also want to be able to easily install it elsewhere
  51. after packing it up into a tarball (b)\.
  52. .RS 0
  53. .IP \(bu 2
  54. \fBnpm install\fP (in package directory, no arguments):
  55. Install the dependencies in the local node_modules folder\.
  56. In global mode (ie, with \fB\-g\fP or \fB\-\-global\fP appended to the command),
  57. it installs the current package context (ie, the current working
  58. directory) as a global package\.
  59. By default, \fBnpm install\fP will install all modules listed as dependencies
  60. in npm help \fBpackage\.json\fP\|\.
  61. With the \fB\-\-production\fP flag (or when the \fBNODE_ENV\fP environment variable
  62. is set to \fBproduction\fP), npm will not install modules listed in
  63. \fBdevDependencies\fP\|\. To install all modules listed in both \fBdependencies\fP
  64. and \fBdevDependencies\fP when \fBNODE_ENV\fP environment variable is set to \fBproduction\fP,
  65. you can use \fB\-\-production=false\fP\|\.
  66. .QP
  67. NOTE: The \fB\-\-production\fP flag has no particular meaning when adding a
  68. dependency to a project\.
  69. .
  70. .IP \(bu 2
  71. \fBnpm install <folder>\fP:
  72. Install the package in the directory as a symlink in the current project\.
  73. Its dependencies will be installed before it's linked\. If \fB<folder>\fP sits
  74. inside the root of your project, its dependencies may be hoisted to the
  75. toplevel \fBnode_modules\fP as they would for other types of dependencies\.
  76. .IP \(bu 2
  77. \fBnpm install <tarball file>\fP:
  78. Install a package that is sitting on the filesystem\. Note: if you just want
  79. to link a dev directory into your npm root, you can do this more easily by
  80. using \fBnpm link\fP\|\.
  81. Tarball requirements:
  82. .RS
  83. .IP \(bu 2
  84. The filename \fImust\fR use \fB\|\.tar\fP, \fB\|\.tar\.gz\fP, or \fB\|\.tgz\fP as
  85. the extension\.
  86. .IP \(bu 2
  87. The package contents should reside in a subfolder inside the tarball (usually it is called \fBpackage/\fP)\. npm strips one directory layer when installing the package (an equivalent of \fBtar x \-\-strip\-components=1\fP is run)\.
  88. .IP \(bu 2
  89. The package must contain a \fBpackage\.json\fP file with \fBname\fP and \fBversion\fP properties\.
  90. Example:
  91. .P
  92. .RS 2
  93. .nf
  94. npm install \./package\.tgz
  95. .fi
  96. .RE
  97. .RE
  98. .IP \(bu 2
  99. \fBnpm install <tarball url>\fP:
  100. Fetch the tarball url, and then install it\. In order to distinguish between
  101. this and other options, the argument must start with "http://" or "https://"
  102. Example:
  103. .P
  104. .RS 2
  105. .nf
  106. npm install https://github\.com/indexzero/forever/tarball/v0\.5\.6
  107. .fi
  108. .RE
  109. .IP \(bu 2
  110. \fBnpm install [<@scope>/]<name>\fP:
  111. Do a \fB<name>@<tag>\fP install, where \fB<tag>\fP is the "tag" config\. (See
  112. npm help \fBconfig\fP\|\. The config's default value is \fBlatest\fP\|\.)
  113. In most cases, this will install the version of the modules tagged as
  114. \fBlatest\fP on the npm registry\.
  115. Example:
  116. .P
  117. .RS 2
  118. .nf
  119. npm install sax
  120. .fi
  121. .RE
  122. .IP \(bu 2
  123. \fBnpm install <alias>@npm:<name>\fP:
  124. Install a package under a custom alias\. Allows multiple versions of
  125. a same\-name package side\-by\-side, more convenient import names for
  126. packages with otherwise long ones and using git forks replacements
  127. or forked npm packages as replacements\. Aliasing works only on your
  128. project and does not rename packages in transitive dependencies\.
  129. Aliases should follow the naming conventions stated in
  130. \fBvalidate\-npm\-package\-name\fP \fIhttps://www\.npmjs\.com/package/validate\-npm\-package\-name#naming\-rules\fR\|\.
  131. Examples:
  132. .P
  133. .RS 2
  134. .nf
  135. npm install my\-react@npm:react
  136. npm install jquery2@npm:jquery@2
  137. npm install jquery3@npm:jquery@3
  138. npm install npa@npm:npm\-package\-arg
  139. .fi
  140. .RE
  141. .RE
  142. .P
  143. .RS 2
  144. .nf
  145. `npm install` saves any specified packages into `dependencies` by default\.
  146. Additionally, you can control where and how they get saved with some
  147. additional flags:
  148. * `\-P, \-\-save\-prod`: Package will appear in your `dependencies`\. This is the
  149. default unless `\-D` or `\-O` are present\.
  150. * `\-D, \-\-save\-dev`: Package will appear in your `devDependencies`\.
  151. * `\-O, \-\-save\-optional`: Package will appear in your `optionalDependencies`\.
  152. * `\-\-no\-save`: Prevents saving to `dependencies`\.
  153. When using any of the above options to save dependencies to your
  154. package\.json, there are two additional, optional flags:
  155. * `\-E, \-\-save\-exact`: Saved dependencies will be configured with an
  156. exact version rather than using npm's default semver range
  157. operator\.
  158. * `\-B, \-\-save\-bundle`: Saved dependencies will also be added to your `bundleDependencies` list\.
  159. Further, if you have an `npm\-shrinkwrap\.json` or `package\-lock\.json` then it
  160. will be updated as well\.
  161. `<scope>` is optional\. The package will be downloaded from the registry
  162. associated with the specified scope\. If no registry is associated with
  163. the given scope the default registry is assumed\. See npm help `scope`\.
  164. Note: if you do not include the @\-symbol on your scope name, npm will
  165. interpret this as a GitHub repository instead, see below\. Scopes names
  166. must also be followed by a slash\.
  167. Examples:
  168. ```bash
  169. npm install sax
  170. npm install githubname/reponame
  171. npm install @myorg/privatepackage
  172. npm install node\-tap \-\-save\-dev
  173. npm install dtrace\-provider \-\-save\-optional
  174. npm install readable\-stream \-\-save\-exact
  175. npm install ansi\-regex \-\-save\-bundle
  176. ```
  177. **Note**: If there is a file or folder named `<name>` in the current
  178. working directory, then it will try to install that, and only try to
  179. fetch the package by name if it is not valid\.
  180. .fi
  181. .RE
  182. .RS 0
  183. .IP \(bu 2
  184. \fBnpm install [<@scope>/]<name>@<tag>\fP:
  185. Install the version of the package that is referenced by the specified tag\.
  186. If the tag does not exist in the registry data for that package, then this
  187. will fail\.
  188. Example:
  189. .P
  190. .RS 2
  191. .nf
  192. npm install sax@latest
  193. npm install @myorg/mypackage@latest
  194. .fi
  195. .RE
  196. .IP \(bu 2
  197. \fBnpm install [<@scope>/]<name>@<version>\fP:
  198. Install the specified version of the package\. This will fail if the
  199. version has not been published to the registry\.
  200. Example:
  201. .P
  202. .RS 2
  203. .nf
  204. npm install sax@0\.1\.1
  205. npm install @myorg/privatepackage@1\.5\.0
  206. .fi
  207. .RE
  208. .IP \(bu 2
  209. \fBnpm install [<@scope>/]<name>@<version range>\fP:
  210. Install a version of the package matching the specified version range\. This
  211. will follow the same rules for resolving dependencies described in npm help \fBpackage\.json\fP\|\.
  212. Note that most version ranges must be put in quotes so that your shell will
  213. treat it as a single argument\.
  214. Example:
  215. .P
  216. .RS 2
  217. .nf
  218. npm install sax@">=0\.1\.0 <0\.2\.0"
  219. npm install @myorg/privatepackage@">=0\.1\.0 <0\.2\.0"
  220. .fi
  221. .RE
  222. .IP \(bu 2
  223. \fBnpm install <git remote url>\fP:
  224. Installs the package from the hosted git provider, cloning it with \fBgit\fP\|\.
  225. For a full git remote url, only that URL will be attempted\.
  226. .P
  227. .RS 2
  228. .nf
  229. <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit\-ish> | #semver:<semver>]
  230. .fi
  231. .RE
  232. \fB<protocol>\fP is one of \fBgit\fP, \fBgit+ssh\fP, \fBgit+http\fP, \fBgit+https\fP, or
  233. \fBgit+file\fP\|\.
  234. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  235. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP can
  236. be any valid semver range or exact version, and npm will look for any tags
  237. or refs matching that range in the remote repository, much as it would for a
  238. registry dependency\. If neither \fB#<commit\-ish>\fP or \fB#semver:<semver>\fP is
  239. specified, then the default branch of the repository is used\.
  240. If the repository makes use of submodules, those submodules will be cloned
  241. as well\.
  242. If the package being installed contains a \fBprepare\fP script, its
  243. \fBdependencies\fP and \fBdevDependencies\fP will be installed, and the prepare
  244. script will be run, before the package is packaged and installed\.
  245. The following git environment variables are recognized by npm and will be
  246. added to the environment when running git:
  247. .RS
  248. .IP \(bu 2
  249. \fBGIT_ASKPASS\fP
  250. .IP \(bu 2
  251. \fBGIT_EXEC_PATH\fP
  252. .IP \(bu 2
  253. \fBGIT_PROXY_COMMAND\fP
  254. .IP \(bu 2
  255. \fBGIT_SSH\fP
  256. .IP \(bu 2
  257. \fBGIT_SSH_COMMAND\fP
  258. .IP \(bu 2
  259. \fBGIT_SSL_CAINFO\fP
  260. .IP \(bu 2
  261. \fBGIT_SSL_NO_VERIFY\fP
  262. See the git man page for details\.
  263. Examples:
  264. .P
  265. .RS 2
  266. .nf
  267. npm install git+ssh://git@github\.com:npm/cli\.git#v1\.0\.27
  268. npm install git+ssh://git@github\.com:npm/cli#semver:^5\.0
  269. npm install git+https://isaacs@github\.com/npm/cli\.git
  270. npm install git://github\.com/npm/cli\.git#v1\.0\.27
  271. GIT_SSH_COMMAND='ssh \-i ~/\.ssh/custom_ident' npm install git+ssh://git@github\.com:npm/cli\.git
  272. .fi
  273. .RE
  274. .RE
  275. .IP \(bu 2
  276. \fBnpm install <githubname>/<githubrepo>[#<commit\-ish>]\fP:
  277. .IP \(bu 2
  278. \fBnpm install github:<githubname>/<githubrepo>[#<commit\-ish>]\fP:
  279. Install the package at \fBhttps://github\.com/githubname/githubrepo\fP by
  280. attempting to clone it using \fBgit\fP\|\.
  281. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  282. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP can
  283. be any valid semver range or exact version, and npm will look for any tags
  284. or refs matching that range in the remote repository, much as it would for a
  285. registry dependency\. If neither \fB#<commit\-ish>\fP or \fB#semver:<semver>\fP is
  286. specified, then \fBmaster\fP is used\.
  287. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP will
  288. be installed if the package has a \fBprepare\fP script, before the package is
  289. done installing\.
  290. Examples:
  291. .P
  292. .RS 2
  293. .nf
  294. npm install mygithubuser/myproject
  295. npm install github:mygithubuser/myproject
  296. .fi
  297. .RE
  298. .IP \(bu 2
  299. \fBnpm install gist:[<githubname>/]<gistID>[#<commit\-ish>|#semver:<semver>]\fP:
  300. Install the package at \fBhttps://gist\.github\.com/gistID\fP by attempting to
  301. clone it using \fBgit\fP\|\. The GitHub username associated with the gist is
  302. optional and will not be saved in \fBpackage\.json\fP\|\.
  303. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP will
  304. be installed if the package has a \fBprepare\fP script, before the package is
  305. done installing\.
  306. Example:
  307. .P
  308. .RS 2
  309. .nf
  310. npm install gist:101a11beef
  311. .fi
  312. .RE
  313. .IP \(bu 2
  314. \fBnpm install bitbucket:<bitbucketname>/<bitbucketrepo>[#<commit\-ish>]\fP:
  315. Install the package at \fBhttps://bitbucket\.org/bitbucketname/bitbucketrepo\fP
  316. by attempting to clone it using \fBgit\fP\|\.
  317. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  318. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP can
  319. be any valid semver range or exact version, and npm will look for any tags
  320. or refs matching that range in the remote repository, much as it would for a
  321. registry dependency\. If neither \fB#<commit\-ish>\fP or \fB#semver:<semver>\fP is
  322. specified, then \fBmaster\fP is used\.
  323. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP will
  324. be installed if the package has a \fBprepare\fP script, before the package is
  325. done installing\.
  326. Example:
  327. .P
  328. .RS 2
  329. .nf
  330. npm install bitbucket:mybitbucketuser/myproject
  331. .fi
  332. .RE
  333. .IP \(bu 2
  334. \fBnpm install gitlab:<gitlabname>/<gitlabrepo>[#<commit\-ish>]\fP:
  335. Install the package at \fBhttps://gitlab\.com/gitlabname/gitlabrepo\fP
  336. by attempting to clone it using \fBgit\fP\|\.
  337. If \fB#<commit\-ish>\fP is provided, it will be used to clone exactly that
  338. commit\. If the commit\-ish has the format \fB#semver:<semver>\fP, \fB<semver>\fP can
  339. be any valid semver range or exact version, and npm will look for any tags
  340. or refs matching that range in the remote repository, much as it would for a
  341. registry dependency\. If neither \fB#<commit\-ish>\fP or \fB#semver:<semver>\fP is
  342. specified, then \fBmaster\fP is used\.
  343. As with regular git dependencies, \fBdependencies\fP and \fBdevDependencies\fP will
  344. be installed if the package has a \fBprepare\fP script, before the package is
  345. done installing\.
  346. Example:
  347. .P
  348. .RS 2
  349. .nf
  350. npm install gitlab:mygitlabuser/myproject
  351. npm install gitlab:myusr/myproj#semver:^5\.0
  352. .fi
  353. .RE
  354. .RE
  355. .P
  356. You may combine multiple arguments, and even multiple types of arguments\.
  357. For example:
  358. .P
  359. .RS 2
  360. .nf
  361. npm install sax@">=0\.1\.0 <0\.2\.0" bench supervisor
  362. .fi
  363. .RE
  364. .P
  365. The \fB\-\-tag\fP argument will apply to all of the specified install targets\. If a
  366. tag with the given name exists, the tagged version is preferred over newer
  367. versions\.
  368. .P
  369. The \fB\-\-dry\-run\fP argument will report in the usual way what the install would
  370. have done without actually installing anything\.
  371. .P
  372. The \fB\-\-package\-lock\-only\fP argument will only update the \fBpackage\-lock\.json\fP,
  373. instead of checking \fBnode_modules\fP and downloading dependencies\.
  374. .P
  375. The \fB\-f\fP or \fB\-\-force\fP argument will force npm to fetch remote resources even if a
  376. local copy exists on disk\.
  377. .P
  378. .RS 2
  379. .nf
  380. npm install sax \-\-force
  381. .fi
  382. .RE
  383. .P
  384. The \fB\-\-no\-fund\fP argument will hide the message displayed at the end of each
  385. install that acknowledges the number of dependencies looking for funding\.
  386. See \fBnpm\-fund(1)\fP
  387. .P
  388. The \fB\-g\fP or \fB\-\-global\fP argument will cause npm to install the package globally
  389. rather than locally\. See npm help folders\.
  390. .P
  391. The \fB\-\-global\-style\fP argument will cause npm to install the package into
  392. your local \fBnode_modules\fP folder with the same layout it uses with the
  393. global \fBnode_modules\fP folder\. Only your direct dependencies will show in
  394. \fBnode_modules\fP and everything they depend on will be flattened in their
  395. \fBnode_modules\fP folders\. This obviously will eliminate some deduping\.
  396. .P
  397. The \fB\-\-ignore\-scripts\fP argument will cause npm to not execute any
  398. scripts defined in the package\.json\. See npm help \fBscripts\fP\|\.
  399. .P
  400. The \fB\-\-legacy\-bundling\fP argument will cause npm to install the package such
  401. that versions of npm prior to 1\.4, such as the one included with node 0\.8,
  402. can install the package\. This eliminates all automatic deduping\.
  403. .P
  404. The \fB\-\-link\fP argument will cause npm to link global installs into the
  405. local space in some cases\.
  406. .P
  407. The \fB\-\-no\-bin\-links\fP argument will prevent npm from creating symlinks for
  408. any binaries the package might contain\.
  409. .P
  410. The \fB\-\-no\-optional\fP argument will prevent optional dependencies from
  411. being installed\.
  412. .P
  413. The \fB\-\-no\-shrinkwrap\fP argument, which will ignore an available
  414. package lock or shrinkwrap file and use the package\.json instead\.
  415. .P
  416. The \fB\-\-no\-package\-lock\fP argument will prevent npm from creating a
  417. \fBpackage\-lock\.json\fP file\. When running with package\-lock's disabled npm
  418. will not automatically prune your node modules when installing\.
  419. .P
  420. The \fB\-\-nodedir=/path/to/node/source\fP argument will allow npm to find the
  421. node source code so that npm can compile native modules\.
  422. .P
  423. The \fB\-\-only={prod[uction]|dev[elopment]}\fP argument will cause either only
  424. \fBdevDependencies\fP or only non\-\fBdevDependencies\fP to be installed regardless of the \fBNODE_ENV\fP\|\.
  425. .P
  426. The \fB\-\-no\-audit\fP argument can be used to disable sending of audit reports to
  427. the configured registries\. See \fBnpm\-audit\fP \fInpm\-audit\fR for details on what is sent\.
  428. .P
  429. See npm help \fBconfig\fP\|\. Many of the configuration params have some
  430. effect on installation, since that's most of what npm does\.
  431. .SS Algorithm
  432. .P
  433. To install a package, npm uses the following algorithm:
  434. .P
  435. .RS 2
  436. .nf
  437. load the existing node_modules tree from disk
  438. clone the tree
  439. fetch the package\.json and assorted metadata and add it to the clone
  440. walk the clone and add any missing dependencies
  441. dependencies will be added as close to the top as is possible
  442. without breaking any other modules
  443. compare the original tree with the cloned tree and make a list of
  444. actions to take to convert one to the other
  445. execute all of the actions, deepest first
  446. kinds of actions are install, update, remove and move
  447. .fi
  448. .RE
  449. .P
  450. For this \fBpackage{dep}\fP structure: \fBA{B,C}, B{C}, C{D}\fP,
  451. this algorithm produces:
  452. .P
  453. .RS 2
  454. .nf
  455. A
  456. +\-\- B
  457. +\-\- C
  458. +\-\- D
  459. .fi
  460. .RE
  461. .P
  462. That is, the dependency from B to C is satisfied by the fact that A
  463. already caused C to be installed at a higher level\. D is still installed
  464. at the top level because nothing conflicts with it\.
  465. .P
  466. For \fBA{B,C}, B{C,D@1}, C{D@2}\fP, this algorithm produces:
  467. .P
  468. .RS 2
  469. .nf
  470. A
  471. +\-\- B
  472. +\-\- C
  473. `\-\- D@2
  474. +\-\- D@1
  475. .fi
  476. .RE
  477. .P
  478. Because B's D@1 will be installed in the top level, C now has to install D@2
  479. privately for itself\. This algorithm is deterministic, but different trees may
  480. be produced if two dependencies are requested for installation in a different
  481. order\.
  482. .P
  483. See npm help folders for a more detailed description of the specific folder structures that npm creates\.
  484. .SS Limitations of npm's Install Algorithm
  485. .P
  486. npm will refuse to install any package with an identical name to the
  487. current package\. This can be overridden with the \fB\-\-force\fP flag, but in
  488. most cases can simply be addressed by changing the local package name\.
  489. .P
  490. There are some very rare and pathological edge\-cases where a cycle can
  491. cause npm to try to install a never\-ending tree of packages\. Here is
  492. the simplest case:
  493. .P
  494. .RS 2
  495. .nf
  496. A \-> B \-> A' \-> B' \-> A \-> B \-> A' \-> B' \-> A \-> \.\.\.
  497. .fi
  498. .RE
  499. .P
  500. where \fBA\fP is some version of a package, and \fBA'\fP is a different version
  501. of the same package\. Because \fBB\fP depends on a different version of \fBA\fP
  502. than the one that is already in the tree, it must install a separate
  503. copy\. The same is true of \fBA'\fP, which must install \fBB'\fP\|\. Because \fBB'\fP
  504. depends on the original version of \fBA\fP, which has been overridden, the
  505. cycle falls into infinite regress\.
  506. .P
  507. To avoid this situation, npm flat\-out refuses to install any
  508. \fBname@version\fP that is already present anywhere in the tree of package
  509. folder ancestors\. A more correct, but more complex, solution would be
  510. to symlink the existing version into the new location\. If this ever
  511. affects a real use\-case, it will be investigated\.
  512. .SS See Also
  513. .RS 0
  514. .IP \(bu 2
  515. npm help folders
  516. .IP \(bu 2
  517. npm help update
  518. .IP \(bu 2
  519. npm help audit
  520. .IP \(bu 2
  521. npm help fund
  522. .IP \(bu 2
  523. npm help link
  524. .IP \(bu 2
  525. npm help rebuild
  526. .IP \(bu 2
  527. npm help scripts
  528. .IP \(bu 2
  529. npm help build
  530. .IP \(bu 2
  531. npm help config
  532. .IP \(bu 2
  533. npm help npmrc
  534. .IP \(bu 2
  535. npm help registry
  536. .IP \(bu 2
  537. npm help dist\-tag
  538. .IP \(bu 2
  539. npm help uninstall
  540. .IP \(bu 2
  541. npm help shrinkwrap
  542. .IP \(bu 2
  543. npm help package\.json
  544. .RE