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
| Option | Description |
|---|---|
--recursive | List all dependency paths from each workspace |
--json | Format the output as an NDJSON stream |
--peers | Also print peer dependencies that match the specified name |