@hwbdev/nested-package v1.0.2
This package is used to test where and how npm installs packages when the package themself have other dependencies.
npm will try to install any packages in the top-most level node_modules folder. However, if that can't be done because two packages have the same dependency but the dependency's version is different, then npm will install the dependency in the package's local node_module folder.
Try the following. Both @hwbdev/nested-package
and @hwbdev/nested-package-two
have @hwbdev/say-something
as dependencies with different semver specifier, but there does not exist a version that fulfills both specifier. If we run npm i @hwbdev/nested-package @hwbdev/nested-package-two
, we will see that npm installs two versions of @hwbdev/say-something
, one at the top-level, and one at the package's local node-module level.
If we now run npm i @hwbdev/nested-package @hwbdev/nested-package-two @hwbdev/say-something@1.0.10
, we will see @hwbdev/say-something@1.0.10
is install at the top level, while there are two other versions installed locally, one in @hwbdev/nested-package
and the other in @hwbdev/nested-package-two
.
For more detail, see https://docs.npmjs.com/cli/v6/commands/npm-install#algorithm