dnodejs.com 每日分享 - npm 非常用命令

461 阅读1分钟

npm 系列第 3 篇我们选择来介绍一下 :

npm outdated [ [ ...]]
它有什么用呢?
我们可以指定某一个工具包来看看它是否过期了
比如:
npm outdated grunt-contrib-htmlmin
输入后你会看到:

1、wanted 其实是你在 package.json 里面自己定义的;

2、latest是这个包的最新版本。

The resulting field 'wanted' shows the latest version according to the version specified in the package.json, the field 'latest' the very latest version of the package.
当然,它还有一些扩展方式,比如:
npm outdated grunt-contrib-htmlmin -json
会返回一个 json 对象:
{
"grunt-contrib-htmlmin": {
"current": "0.1.3",
"wanted": "0.3.0",
"latest": "0.4.0",
"location": "node_modules/grunt-contrib-htmlmin"
}
}

当然如何你想看当前目录,就直接执行下面命令

npm outdated

当然如何你想看全局安装的包,就直接执行下面命令

npm outdated -g
更多查看:
docs.npmjs.com/cli/outdate…