bun Verified current stable Not installed? Package Management

Bun / Display Global Module Cache Path

Display Global Module Cache Path

Display the path to the global module cache directory.

$
Terminal
bun pm cache

When To Use

When troubleshooting slow operations due to cache issues or validating cache content.

Pro Tip

Consider inspecting the cache with tools like `du` to analyze size and contents.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Global module cache path: /usr/local/share/bun/modules/cache

Anatomy of Output

Understanding the result

/usr/local/share/bun/cache/modules Cache Path

Displays the directory location of the global cache.

Cache size: 150MB Cache Size

Indicates total size of cached modules.

Cleanup recommended: Cache exceeding 200MB Optimization Advice

Informs about cache size approaching limits.

Power User Variants

Optimized versions

bun pm cache --verbose

Show extended information about cache contents.

bun pm cache --list

List all files within the cache directory.

Troubleshooting

Common pitfalls

Error: Unable to access cache path

Solution: Verify permissions for the cache directory.

Error: Cache path not set

Solution: Ensure Bun is correctly configured.

Error: Misconfiguration detected in cache settings

Solution: Check your Bun configuration files.

Command Breakdown

What each part is doing

bun
Base Command
The executable that performs this operation. Here it runs Bun before the shell applies any redirect operators.

How To Run

Execution path

  1. Step 1

    Run the command: `bun pm cache`

  2. Step 2

    Check the output to confirm the cache path is displayed correctly.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.