簡體   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