npm-outdated
选择命令行版本:
See Details
目录
概要
¥Synopsis
npm outdated [<package-spec> ...]
描述
¥Description
此命令将检查注册表以查看当前是否有任何(或特定)已安装的包已过时。
¥This command will check the registry to see if any (or, specific) installed packages are currently outdated.
默认情况下,仅显示根项目的直接依赖和配置的工作区的直接依赖。也可以使用 --all
查找所有过时的元依赖。
¥By default, only the direct dependencies of the root project and direct dependencies of your configured workspaces are shown. Use --all
to find all outdated meta-dependencies as well.
在输出中:
¥In the output:
-
wanted
是满足package.json
中指定的 semver 范围的包的最大版本。如果没有可用的 semver 范围(即你正在运行npm outdated --global
,或者该包未包含在package.json
中),则wanted
显示当前安装的版本。¥
wanted
is the maximum version of the package that satisfies the semver range specified inpackage.json
. If there's no available semver range (i.e. you're runningnpm outdated --global
, or the package isn't included inpackage.json
), thenwanted
shows the currently-installed version. -
latest
是在注册表中标记为最新的包的版本。在没有特殊配置的情况下运行npm publish
将发布带有latest
的 dist-tag 的包。这可能是也可能不是包的最高版本,或者是最近发布的包版本,这取决于包的开发者如何管理最新的 dist-tag。¥
latest
is the version of the package tagged as latest in the registry. Runningnpm publish
with no special configuration will publish the package with a dist-tag oflatest
. 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. -
location
是包 在物理树中的位置。¥
location
is where in the physical tree the package is located. -
depended by
显示哪个包依赖于显示的依赖¥
depended by
shows which package depends on the displayed dependency -
package type
(使用--long
/-l
时)告诉你这个包是dependency
还是 dev/peer/optional 依赖。未包含在package.json
中的包始终标记为dependencies
。¥
package type
(when using--long
/-l
) tells you whether this package is adependency
or a dev/peer/optional dependency. Packages not included inpackage.json
are always markeddependencies
. -
homepage
(使用--long
/-l
时)是包的包中包含的homepage
值¥
homepage
(when using--long
/-l
) is thehomepage
value contained in the package's packument -
红色表示有更新的版本符合你的 semver 要求,因此你应该立即更新。
¥Red means there's a newer version matching your semver requirements, so you should update now.
-
黄色表示有高于你的 semver 要求的较新版本(通常是新的主要版本或新的 0.x 次要版本),因此请谨慎操作。
¥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
$ npm outdatedPackage Current Wanted Latest Location Depended byglob 5.0.15 5.0.15 6.0.1 node_modules/glob dependent-package-namenothingness 0.0.3 git git node_modules/nothingness dependent-package-namenpm 3.5.1 3.5.2 3.5.1 node_modules/npm dependent-package-namelocal-dev 0.0.3 linked linked local-dev dependent-package-nameonce 1.3.2 1.3.3 1.3.3 node_modules/once dependent-package-name
有了这些 dependencies
:
¥With these dependencies
:
{"glob": "^5.0.15","nothingness": "github:othiym23/nothingness#master","npm": "^3.5.1","once": "^1.3.1"}
需要注意的几点:
¥A few things to note:
-
glob
需要^5
,这会阻止 npm 安装超出 semver 范围的glob@6
。¥
glob
requires^5
, which prevents npm from installingglob@6
, which is outside the semver range. -
Git 依赖总是会被重新安装,因为它们是如何指定的。安装的 committish 可能满足依赖说明符(如果它是不可变的,例如提交 SHA),也可能不满足,因此
npm outdated
和npm update
必须获取 Git 存储库进行检查。这就是为什么当前重新安装 Git 依赖总是会强制进行新的克隆和安装。¥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
andnpm 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. -
npm@3.5.2
被标记为 "wanted",但是 "latest" 是npm@3.5.1
,因为 npm 使用 dist-tags 来管理它的latest
和next
发布通道。npm update
将安装最新版本,但npm install npm
(没有 semver 范围)将安装标记为latest
的任何内容。¥
npm@3.5.2
is marked as "wanted", but "latest" isnpm@3.5.1
because npm uses dist-tags to manage itslatest
andnext
release channels.npm update
will install the newest version, butnpm install npm
(with no semver range) will install whatever's tagged aslatest
. -
once
已经过时了。从头开始重新安装node_modules
或运行npm update
将使其符合规范。¥
once
is just plain out of date. Reinstallingnode_modules
from scratch or runningnpm update
will bring it up to spec.
配置
¥Configuration
all
-
默认值:false
¥Default: false
-
类型:布尔值
¥Type: Boolean
运行 npm outdated
和 npm ls
时,设置 --all
将显示所有过时或已安装的包,而不仅仅是当前项目直接依赖的包。
¥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
-
默认值:false
¥Default: false
-
类型:布尔值
¥Type: Boolean
是否输出 JSON 数据,而不是正常输出。
¥Whether or not to output JSON data, rather than the normal output.