-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
351 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,21 @@ aliases: list, la, ll | |
### Description | ||
|
||
This command will print to stdout all the versions of packages that are | ||
installed, as well as their dependencies, in a tree-structure. | ||
installed, as well as their dependencies when `--all` is specified, in a | ||
tree structure. | ||
|
||
Positional arguments are `name@version-range` identifiers, which will | ||
limit the results to only the paths to the packages named. Note that | ||
nested packages will *also* show the paths to the specified packages. | ||
For example, running `npm ls promzard` in npm's source tree will show: | ||
Note: to get a "bottoms up" view of why a given package is included in the | ||
tree at all, use [`npm explain`](/commands/npm-explain). | ||
|
||
Positional arguments are `name@version-range` identifiers, which will limit | ||
the results to only the paths to the packages named. Note that nested | ||
packages will *also* show the paths to the specified packages. For | ||
example, running `npm ls promzard` in npm's source tree will show: | ||
|
||
```bash | ||
npm@@VERSION@ /path/to/npm | ||
└─┬ [email protected] | ||
└── [email protected] | ||
npm@@VERSION@ /path/to/npm | ||
└─┬ [email protected] | ||
└── [email protected] | ||
``` | ||
|
||
It will print out extraneous, missing, and invalid packages. | ||
|
@@ -35,12 +39,49 @@ in parentheses after the name@version to make it easier for users to | |
recognize potential forks of a project. | ||
|
||
The tree shown is the logical dependency tree, based on package | ||
dependencies, not the physical layout of your node_modules folder. | ||
dependencies, not the physical layout of your `node_modules` folder. | ||
|
||
When run as `ll` or `la`, it shows extended information by default. | ||
|
||
### Note: Design Changes Pending | ||
|
||
The `npm ls` command's output and behavior made a _ton_ of sense when npm | ||
created a `node_modules` folder that naively nested every dependency. In | ||
such a case, the logical dependency graph and physical tree of packages on | ||
disk would be roughly identical. | ||
|
||
With the advent of automatic install-time deduplication of dependencies in | ||
npm v3, the `ls` output was modified to display the logical dependency | ||
graph as a tree structure, since this was more useful to most users. | ||
However, without using `npm ls -l`, it became impossible show _where_ a | ||
package was actually installed much of the time! | ||
|
||
With the advent of automatic installation of `peerDependencies` in npm v7, | ||
this gets even more curious, as `peerDependencies` are logically | ||
"underneath" their dependents in the dependency graph, but are always | ||
physically at or above their location on disk. | ||
|
||
Also, in the years since npm got an `ls` command (in version 0.0.2!), | ||
dependency graphs have gotten much larger as a general rule. Therefor, in | ||
order to avoid dumping an excessive amount of content to the terminal, `npm | ||
ls` now only shows the _top_ level dependencies, unless `--all` is | ||
provided. | ||
|
||
A thorough re-examination of the use cases, intention, behavior, and output | ||
of this command, is currently underway. Expect significant changes to at | ||
least the default human-readable `npm ls` output in npm v8. | ||
|
||
### Configuration | ||
|
||
#### all | ||
|
||
* Default: `false` | ||
* Type: Boolean | ||
|
||
When running `npm outdated` and `npm ls`, setting `--all` will show all | ||
outdated or installed packages, rather than only those directly depended | ||
upon by the current project. | ||
|
||
#### json | ||
|
||
* Default: false | ||
|
@@ -115,6 +156,7 @@ Set it to false in order to use all-ansi output. | |
|
||
### See Also | ||
|
||
* [npm explain](/commands/npm-explain) | ||
* [npm config](/commands/npm-config) | ||
* [npmrc](/configuring-npm/npmrc) | ||
* [npm folders](/configuring-npm/folders) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,25 +15,34 @@ npm outdated [[<@scope>/]<pkg> ...] | |
This command will check the registry to see if any (or, specific) installed | ||
packages are currently outdated. | ||
|
||
By default, only the direct dependencies of the root project are shown. | ||
Use `--all` to find all outdated meta-dependencies as well. | ||
|
||
In the output: | ||
|
||
* `wanted` is the maximum version of the package that satisfies the semver | ||
range specified in `package.json`. If there's no available semver range (i.e. | ||
you're running `npm outdated --global`, or the package isn't included in | ||
`package.json`), then `wanted` shows the currently-installed version. | ||
range specified in `package.json`. If there's no available semver range | ||
(i.e. you're running `npm outdated --global`, or the package isn't | ||
included in `package.json`), then `wanted` shows the currently-installed | ||
version. | ||
* `latest` is the version of the package tagged as latest in the registry. | ||
Running `npm publish` with no special configuration will publish the package | ||
with a dist-tag of `latest`. This may or may not be the maximum version of | ||
the package, or the most-recently published version of the package, depending | ||
on how the package's developer manages the latest [dist-tag](npm-dist-tag). | ||
Running `npm publish` with no special configuration will publish the | ||
package with a dist-tag of `latest`. This may or may not be the maximum | ||
version of the package, or the most-recently published version of the | ||
package, depending on how the package's developer manages the latest | ||
[dist-tag](/commands/npm-dist-tag). | ||
* `location` is where in the physical tree the package is located. | ||
* `depended by` shows which package depends on the displayed dependency | ||
* `package type` (when using `--long` / `-l`) tells you whether this package is | ||
a `dependency` or a dev/peer/optional dependency. Packages not included in `package.json` | ||
are always marked `dependencies`. | ||
* `homepage` (when using `--long` / `-l`) is the `homepage` value contained in the package's packument | ||
* Red means there's a newer version matching your semver requirements, so you should update now. | ||
* Yellow indicates that there's a newer version above your semver requirements (usually new major, or new 0.x minor) so proceed with caution. | ||
* `package type` (when using `--long` / `-l`) tells you whether this | ||
package is a `dependency` or a dev/peer/optional dependency. Packages not | ||
included in `package.json` are always marked `dependencies`. | ||
* `homepage` (when using `--long` / `-l`) is the `homepage` value contained | ||
in the package's packument | ||
* Red means there's a newer version matching your semver requirements, so | ||
you should update now. | ||
* Yellow indicates that there's a newer version _above_ your semver | ||
requirements (usually new major, or new 0.x minor) so proceed with | ||
caution. | ||
|
||
### An example | ||
|
||
|
@@ -59,19 +68,20 @@ With these `dependencies`: | |
|
||
A few things to note: | ||
|
||
* `glob` requires `^5`, which prevents npm from installing `glob@6`, which is | ||
outside the semver range. | ||
* Git dependencies will always be reinstalled, because of how they're specified. | ||
The installed committish might satisfy the dependency specifier (if it's | ||
something immutable, like a commit SHA), or it might not, so `npm outdated` and | ||
`npm update` have to fetch Git repos to check. This is why currently doing a | ||
reinstall of a Git dependency always forces a new clone and install. | ||
* `[email protected]` is marked as "wanted", but "latest" is `[email protected]` because npm | ||
uses dist-tags to manage its `latest` and `next` release channels. `npm update` | ||
will install the _newest_ version, but `npm install npm` (with no semver range) | ||
will install whatever's tagged as `latest`. | ||
* `once` is just plain out of date. Reinstalling `node_modules` from scratch or | ||
running `npm update` will bring it up to spec. | ||
* `glob` requires `^5`, which prevents npm from installing `glob@6`, which | ||
is outside the semver range. | ||
* Git dependencies will always be reinstalled, because of how they're | ||
specified. The installed committish might satisfy the dependency | ||
specifier (if it's something immutable, like a commit SHA), or it might | ||
not, so `npm outdated` and `npm update` have to fetch Git repos to check. | ||
This is why currently doing a reinstall of a Git dependency always forces | ||
a new clone and install. | ||
* `[email protected]` is marked as "wanted", but "latest" is `[email protected]` because | ||
npm uses dist-tags to manage its `latest` and `next` release channels. | ||
`npm update` will install the _newest_ version, but `npm install npm` | ||
(with no semver range) will install whatever's tagged as `latest`. | ||
* `once` is just plain out of date. Reinstalling `node_modules` from | ||
scratch or running `npm update` will bring it up to spec. | ||
|
||
### Configuration | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.