繁体   English   中英

使 `npm ls somepackage` 命令尊重版本范围

[英]Make `npm ls somepackage` command respect version range

我正在尝试使用npm ls来查找安全警告的来源。 文档提到:

位置 arguments 是 name@version-range 标识符,这会将结果限制为仅指定包的路径。

我正在为 package minimist修复 CVE-2020-7598,它说:

CVE-2020-7598 漏洞版本:< 0.2.1 修补版本:0.2.1

现在npm ls minimist跟踪所有依赖项,但我想针对特定范围执行此操作。 所以我试过:

  • npm ls "minimist<0.2.1"给出The system cannot find the file specified.
  • npm ls "minimist@<0.2.1"给出The system cannot find the file specified.
  • npm ls "minimist@<=0.2.0"给出The system cannot find the file specified.
  • npm ls "minimist@0.2.0"给出-- (empty) (这是有道理的,因为例如 0.0.8 在我的树中)

那么,我怎样才能让npm ls返回我的依赖树中某个版本以下的包?

您想要的命令的概要如下:

npm ls <pkg>@"<comparator>"
             ^            ^

注意:双引号仅包含在比较器部分周围。

例如:

npm ls minimist@"<0.2.1"
                ^      ^

引号之间允许使用任何有效的 semver 范围比较器 例如:

npm ls minimist@"<=0.2.0 >=0.0.8"
                ^               ^

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM