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显示当前安装的版本。¥
wantedis 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), thenwantedshows the currently-installed version. -
latest是在注册表中标记为最新的包的版本。在没有特殊配置的情况下运行npm publish将发布带有latest的 dist-tag 的包。这可能是也可能不是包的最高版本,或者是最近发布的包版本,这取决于包的开发者如何管理最新的 dist-tag。¥
latestis the version of the package tagged as latest in the registry. Runningnpm publishwith 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是包在物理树中的位置。¥
locationis where in the physical tree the package is located. -
depended by显示哪个包依赖于显示的依赖¥
depended byshows 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 adependencyor a dev/peer/optional dependency. Packages not included inpackage.jsonare always markeddependencies. -
homepage(使用--long/-l时)是包的包中包含的homepage值¥
homepage(when using--long/-l) is thehomepagevalue 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。¥
globrequires^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 outdatedandnpm updatehave 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.2is marked as "wanted", but "latest" isnpm@3.5.1because npm uses dist-tags to manage itslatestandnextrelease channels.npm updatewill install the newest version, butnpm install npm(with no semver range) will install whatever's tagged aslatest. -
once已经过时了。从头开始重新安装node_modules或运行npm update将使其符合规范。¥
onceis just plain out of date. Reinstallingnode_modulesfrom scratch or runningnpm updatewill 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.
-
在
npm pkg set中,它可以使 用 JSON.parse() 解析集合值,然后再将它们保存到你的package.json。¥In
npm pkg setit enables parsing set values with JSON.parse() before saving them to yourpackage.json.
并非所有 npm 命令都支持。
¥Not supported by all npm commands.
long
-
默认值:false
¥Default: false
-
类型:布 尔值
¥Type: Boolean
在 ls、search 和 help-search 中显示扩展信息。
¥Show extended information in ls, search, and help-search.
parseable
-
默认值:false
¥Default: false
-
类型:布尔值
¥Type: Boolean
从写入标准输出的命令输出可解析的结果。对于 npm search,这将是制表符分隔的表格格式。
¥Output parseable results from commands that write to standard output. For npm search, this will be tab-separated table format.
global
-
默认值:false
¥Default: false
-
类型:布尔值
¥Type: Boolean
在 "global" 模式下运行,以便将包安装到 prefix 文件夹而不是当前工作目录。有关行为差异的更多信息,请参见 文件夹。
¥Operates in "global" mode, so that packages are installed into the prefix folder instead of the current working directory. See folders for more on the differences in behavior.
-
包安装到
{prefix}/lib/node_modules文件夹,而不是当前工作目录。¥packages are installed into the
{prefix}/lib/node_modulesfolder, instead of the current working directory. -
bin 文件链接到
{prefix}/bin¥bin files are linked to
{prefix}/bin -
手册页链接到
{prefix}/share/man¥man pages are linked to
{prefix}/share/man
workspace
-
默认值:
¥Default:
-
类型:字符串(可以设置多次)
¥Type: String (can be set multiple times)
启用在当前项目的已配置工作区的上下文中运行命令,同时通过仅运行此配置选项定义的工作区进行过滤。
¥Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
workspace 配置的有效值为:
¥Valid values for the workspace config are either:
-
工作区名称
¥Workspace names
-
工作区目录的路径
¥Path to a workspace directory
-
父工作区目录的路径(将导致选择该文件夹中的所有工作区)
¥Path to a parent workspace directory (will result in selecting all workspaces within that folder)
为 npm init 命令设置时,可以将其设置为尚不存在的工作区的文件夹,以创建文件夹并将其设置为项目中的全新工作区。
¥When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
此值不会导出到子进程的环境中。
¥This value is not exported to the environment for child processes.
也可以看看
¥See Also