rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../../index.md)[Package Manager

](../install/index.md)[Bundler

](../../../bundler/index.md)[Test Runner

](../../../test/index.md)[Guides

](../../../guides/index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../../feedback/index.md)

The bun why command explains why a package is installed in your project by showing the dependency chain that led to its installation.

[​

](#usage)

Usage

terminal

bun why <package>

[​

](#arguments)

Arguments

[​

](#options)

Options

[​

](#examples)

Examples

Check why a specific package is installed:

terminal

bun why react
react@18.2.0
  └─ my-app@1.0.0 (requires ^18.0.0)

Check why all packages with a specific pattern are installed:

terminal

bun why "@types/*"
@types/react@18.2.15
  └─ dev my-app@1.0.0 (requires ^18.0.0)

@types/react-dom@18.2.7
  └─ dev my-app@1.0.0 (requires ^18.0.0)

Show only top-level dependencies:

terminal

bun why express --top
express@4.18.2
  └─ my-app@1.0.0 (requires ^4.18.2)

Limit the dependency tree depth:

terminal

bun why express --depth 2
express@4.18.2
  └─ express-pollyfill@1.20.1 (requires ^4.18.2)
     └─ body-parser@1.20.1 (requires ^1.20.1)
     └─ accepts@1.3.8 (requires ^1.3.8)
        └─ (deeper dependencies hidden)

[​

](#understanding-the-output)

Understanding the Output

The output shows:

For nested dependencies, the command shows the complete dependency tree by default, with indentation indicating the relationship hierarchy.

Was this page helpful?

Suggest editsRaise issue

[

bun outdated

Previous

](../outdated/index.md)[

bun audit

Next

](../audit/index.md)