npm explain

解释已安装的包

概要

npm explain <folder | specifier>

alias: why

描述

此命令将打印导致在当前项目中安装给定包的依赖链。

位置参数可以是 node_modules 中的文件夹,也可以是 name@version-range 说明符,它们将选择要解释的依赖关系。

例如,在 npm 的源代码树中运行 npm explain glob 将显示:

glob@7.1.6
node_modules/glob
  glob@"^7.1.4" from the root project

glob@7.1.1 dev
node_modules/tacks/node_modules/glob
  glob@"^7.0.5" from rimraf@2.6.2
  node_modules/tacks/node_modules/rimraf
    rimraf@"^2.6.2" from tacks@1.3.0
    node_modules/tacks
      dev tacks@"^1.3.0" from the root project

要仅解释驻留在特定文件夹中的包,请将其作为参数传递给命令。当试图弄清楚为什么要复制给定的依赖项以满足项目中冲突的版本要求时,这可能很有用。

$ npm explain node_modules/nyc/node_modules/find-up
find-up@3.0.0 dev
node_modules/nyc/node_modules/find-up
  find-up@"^3.0.0" from nyc@14.1.1
  node_modules/nyc
    nyc@"^14.1.1" from tap@14.10.8
    node_modules/tap
      dev tap@"^14.10.8" from the root project

配置

json

    cpHcqTIrxEt4f28KOhZfPtN+1DnZvVBVAKYGUmWOIwWGrGLru+wlVoKtqRRY32EZnPsvqMSi6MrpxrMwdvnc+A==

tuWzaBh7Hg0RJSmQRjRdDCwXTeQobgtuYpCLLuAWUpV8N0aZPquIzn8VhL3gVbm5U6rhW7dxvCNiDD2tf/ZQWg==

    0p92ezPAdiik9IRo9I3R1nhwzGveq5GxraVl9fxxy4syFQ/6WqG8+6XxL5j4LCYquhzAOuxdSD1j/dB354BH7JUaGCgZLa7Cnea1xLIaV9Y6h7TLAYANuRCKrHY7b88ObLI+0aFZER/Q9D+FAoY/UuPtiQiqwd1VXUJO6bf0bmfv2uToPcfsbsEggsfkUmBuwHpo8wwJJQ/zwPwghcaStg==

hOnA0CJW/AdzA3UjIYZtvWh880f0PSSG5s/dNWkGKuHLEzJNwqn9/CgFnT6ud15M

workspace

    cpHcqTIrxEt4f28KOhZfPr4z2EOZwDWx2WeIugwss7ndqy3Jwf5x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