Skip to content

yarn why

Terminal window
yarn why

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.

Options

OptionDescription
--recursiveList all dependency paths from each workspace
--jsonFormat the output as an NDJSON stream
--peersAlso print peer dependencies that match the specified name