npm-explain.1 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. .TH "NPM\-EXPLAIN" "1" "October 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-explain\fR \- Explain installed packages
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm explain <folder | specifier>
  9. alias: why
  10. .fi
  11. .RE
  12. .SS Description
  13. .P
  14. This command will print the chain of dependencies causing a given package
  15. to be installed in the current project\.
  16. .P
  17. Positional arguments can be either folders within \fBnode_modules\fP, or
  18. \fBname@version\-range\fP specifiers, which will select the dependency
  19. relationships to explain\.
  20. .P
  21. For example, running \fBnpm explain glob\fP within npm's source tree will show:
  22. .P
  23. .RS 2
  24. .nf
  25. glob@7\.1\.6
  26. node_modules/glob
  27. glob@"^7\.1\.4" from the root project
  28. glob@7\.1\.1 dev
  29. node_modules/tacks/node_modules/glob
  30. glob@"^7\.0\.5" from rimraf@2\.6\.2
  31. node_modules/tacks/node_modules/rimraf
  32. rimraf@"^2\.6\.2" from tacks@1\.3\.0
  33. node_modules/tacks
  34. dev tacks@"^1\.3\.0" from the root project
  35. .fi
  36. .RE
  37. .P
  38. To explain just the package residing at a specific folder, pass that as the
  39. argument to the command\. This can be useful when trying to figure out
  40. exactly why a given dependency is being duplicated to satisfy conflicting
  41. version requirements within the project\.
  42. .P
  43. .RS 2
  44. .nf
  45. $ npm explain node_modules/nyc/node_modules/find\-up
  46. find\-up@3\.0\.0 dev
  47. node_modules/nyc/node_modules/find\-up
  48. find\-up@"^3\.0\.0" from nyc@14\.1\.1
  49. node_modules/nyc
  50. nyc@"^14\.1\.1" from tap@14\.10\.8
  51. node_modules/tap
  52. dev tap@"^14\.10\.8" from the root project
  53. .fi
  54. .RE
  55. .SS Configuration
  56. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  57. <!\-\- automatically generated, do not edit manually \-\->
  58. <!\-\- see lib/utils/config/definitions\.js \-\->
  59. .SS \fBjson\fP
  60. .RS 0
  61. .IP \(bu 2
  62. Default: false
  63. .IP \(bu 2
  64. Type: Boolean
  65. .RE
  66. .P
  67. Whether or not to output JSON data, rather than the normal output\.
  68. .RS 0
  69. .IP \(bu 2
  70. In \fBnpm pkg set\fP it enables parsing set values with JSON\.parse() before
  71. saving them to your \fBpackage\.json\fP\|\.
  72. .RE
  73. .P
  74. Not supported by all npm commands\.
  75. <!\-\- automatically generated, do not edit manually \-\->
  76. <!\-\- see lib/utils/config/definitions\.js \-\->
  77. .SS \fBworkspace\fP
  78. .RS 0
  79. .IP \(bu 2
  80. Default:
  81. .IP \(bu 2
  82. Type: String (can be set multiple times)
  83. .RE
  84. .P
  85. Enable running a command in the context of the configured workspaces of the
  86. current project while filtering by running only the workspaces defined by
  87. this configuration option\.
  88. .P
  89. Valid values for the \fBworkspace\fP config are either:
  90. .RS 0
  91. .IP \(bu 2
  92. Workspace names
  93. .IP \(bu 2
  94. Path to a workspace directory
  95. .IP \(bu 2
  96. Path to a parent workspace directory (will result in selecting all
  97. workspaces within that folder)
  98. .RE
  99. .P
  100. When set for the \fBnpm init\fP command, this may be set to the folder of a
  101. workspace which does not yet exist, to create the folder and set it up as a
  102. brand new workspace within the project\.
  103. .P
  104. This value is not exported to the environment for child processes\.
  105. <!\-\- automatically generated, do not edit manually \-\->
  106. <!\-\- see lib/utils/config/definitions\.js \-\->
  107. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  108. .SS See Also
  109. .RS 0
  110. .IP \(bu 2
  111. npm help config
  112. .IP \(bu 2
  113. npm help npmrc
  114. .IP \(bu 2
  115. npm help folders
  116. .IP \(bu 2
  117. npm help ls
  118. .IP \(bu 2
  119. npm help install
  120. .IP \(bu 2
  121. npm help link
  122. .IP \(bu 2
  123. npm help prune
  124. .IP \(bu 2
  125. npm help outdated
  126. .IP \(bu 2
  127. npm help update
  128. .RE