bun why
command explains why a package is installed in your project by showing the dependency chain that led to its installation.
Usage
terminal
Arguments
<package>
: The name of the package to explain. Supports glob patterns like@org/*
or*-lodash
.
Options
--top
: Show only the top-level dependencies instead of the complete dependency tree.--depth <number>
: Maximum depth of the dependency tree to display.
Examples
Check why a specific package is installed:terminal
terminal
terminal
terminal
Understanding the Output
The output shows:- The package name and version being queried
- The dependency chain that led to its installation
- The type of dependency (dev, peer, optional, or production)
- The version requirement specified in each package’s dependencies