Docs/Reference/CLI/why

yarn why

Display the reason why a package is needed

yarn why <PATTERN>

This command prints the exact reasons why a package appears in the dependency tree.

By default, it will print all packages that directly depend on the specified package. If you want to see all transitive paths that lead to the package (going through all workspaces), use the -R,--recursive flag.

Note that the recursive display is optimized to avoid printing the same package subtree multiple times. If you see a package without children in one branch, it means its subtree was already printed elsewhere in the tree.

#--recursive, -Rboolean

List all dependency paths from each workspace

#--jsonboolean

Format the output as an NDJSON stream

#--peersboolean

Also print peer dependencies that match the specified name