npm-outdated

检查过期的包

概要

npm outdated [[<@scope>/]<pkg> ...]

如果不指定pkg,则检查所有过期的包;若指定pkg,则检查指定的pkg。

描述

此命令将检查注册表,查看是否有安装的包已过时。

在输出中:

  • wanted 显示符合semver规范的最大版本号。若没有多余版本号,则显示当前版本。
  • latest 显示注册表中被标记为latest的版本。默认情况下latest标记表示最新版本,特殊情况下不是,这取决于开发人员的包管理制度。
  • location 显示包在依赖关系树中的位置。请注意,npm outdated默认depth为0,仅看到过期包的顶级依赖项。
  • package 显示包名。若使用了(--long/-l)则还是显示这个包属于dependencies还是devDependency。

示例

随意找一个目录新建package.json,取名为testfornpm。输入命令npm i [email protected] [email protected],得到jquery、swiper及其依赖dom7的包,包jquery、swiper、dom7都已经过期。

> npm outdated
$ npm outdated --depth=1
Package  Current  Wanted  Latest  Location
jquery    1.11.3  1.12.4   3.2.1  testfornpm
swiper     4.0.1   4.0.7   4.0.7  testfornpm
dom7       2.0.1   2.0.1   2.0.2  testfornpm > swiper

Current展示当前安装包的版本,Wanted展示主版本号下最大的版本,latest展示注册表上最新版本,location展示包在依赖树中的位置,默认depth为0,仅能展示顶级依赖项testfornpm,所以depth设置为1,则可以看到更深一度的依赖项swiper。

配置

json
  • Default: false
  • Type: Boolean

以JSON格式显示。

> npm outdated --json
long
  • Default: false
  • Type: Boolean

显示扩展信息。

> npm outdated --long
parseable
  • Default: false
  • Type: Boolean

用output方式代替树形视图方式来展示。

> npm outdated --parseable
global
  • Default: false
  • Type: Boolean

检查全局安装包而不是当前项目中的包。

> npm outdated --global
depth
  • Default: 0
  • Type: Int

检查依赖关系树的最大深度。

> npm outdated --depth=2

results matching ""

    No results matching ""