LinuxCommandLibrary

bun-pm

TLDR

Create a tarball of the current workspace

$ bun pm pack
copy

Print the path to the bin directory
$ bun pm bin
copy

List installed dependencies
$ bun pm ls
copy

Print the npm registry username
$ bun pm whoami
copy

Generate and print the hash of the current lockfile
$ bun pm hash
copy

Print the path to Bun's global module cache
$ bun pm cache
copy

Migrate another package manager's lockfile without installing anything
$ bun pm migrate
copy

Get a property from package.json
$ bun pm pkg get [property]
copy

SYNOPSIS

bun pm {ls|cache} [<options>]

PARAMETERS

ls
    List installed packages with versions and resolutions

cache ls
    List packages in the Bun cache

cache rm
    Remove packages from cache

cache rmdir
    Delete cache directories

--global
    Operate on global packages (ls only)

--parseable
    Output package names separated by newlines (ls only)

--format=json|bun
    Output as JSON or Bun object (ls only)

--only-direct
    Show only direct dependencies (ls only)

--all
    Clear all cache (rm only)

--help
    Show help

--version
    Show version

DESCRIPTION

The bun pm command provides introspection and management tools for Bun's integrated package manager. Bun is an extremely fast all-in-one JavaScript runtime, bundler, and package manager designed as a drop-in replacement for Node.js, npm, pnpm, and Webpack.

It offers subcommands to list installed packages, inspect the dependency tree, and manage the package cache. This is particularly useful for debugging dependency resolution issues, clearing corrupted caches, or verifying installations in CI/CD pipelines.

Key features include table-formatted output for ls, JSON export for scripting, and options to filter direct dependencies or global installs. Bun's PM uses a custom bun.lockb lockfile for reproducible, blazing-fast installs (up to 30x faster than npm).

Usage integrates seamlessly with standard workflows: run bun pm ls after bun install to review deps. Supports workspaces and peer dependencies natively.

CAVEATS

Requires Bun lockfile (bun.lockb); incompatible with npm/yarn lockfiles. Global mode needs Bun global prefix configured.

EXAMPLE USAGE

bun pm ls — lists project deps.
bun pm cache rm --all — clears entire cache.

HISTORY

Introduced in Bun 0.5.0 (April 2023) for dependency inspection. Enhanced in Bun 1.0 (September 2023) with cache management and JSON output. Developed by Oven (Jarred Sumner) as part of Bun's goal for 3x faster installs.

SEE ALSO

bun(1), npm(1), yarn(1), pnpm(1)

Copied to clipboard