Skip to main content
Package manager utilities and commands.

Commands

bun pm bin

Print the path to Bun’s bin directory.
With -g flag, prints the global bin directory:

bun pm cache

Print the path to Bun’s cache directory.
Delete the cache:

bun pm ls

List installed dependencies in a tree structure.
Show all dependencies (including transitive):
Alias: bun list

bun pm hash

Generate and print the hash of the current lockfile.

bun pm hash-string

Print the string used to generate the lockfile hash.

bun pm hash-print

Print the hash stored in the current lockfile.

bun pm migrate

Migrate from another package manager’s lockfile to bun.lockb.
Supported lockfiles:
  • package-lock.json (npm)
  • yarn.lock (Yarn)
  • pnpm-lock.yaml (pnpm)
Force migration (overwrite existing bun.lockb):

bun pm pack

Create a tarball of the current workspace.
See bun pack documentation for more details.

bun pm scan

Scan packages in the lockfile for security vulnerabilities.

bun pm why

Show why a package is installed and what depends on it.

bun pm whoami

Print the currently logged-in npm username.
Alias: bun whoami

bun pm view

View package information from the registry.
View specific version:
View specific field:

bun pm version

Bump the version in package.json and create a git tag.
Increment types:
  • patch - 1.0.0 → 1.0.1
  • minor - 1.0.0 → 1.1.0
  • major - 1.0.0 → 2.0.0
  • prepatch - 1.0.0 → 1.0.1-0
  • preminor - 1.0.0 → 1.1.0-0
  • premajor - 1.0.0 → 2.0.0-0
  • prerelease - 1.0.0 → 1.0.1-0 or 1.0.1-0 → 1.0.1-1
Or specify exact version:

bun pm pkg

Manage fields in package.json.

Get field

Set field

Delete field

Fix common errors

bun pm untrusted

Print current untrusted dependencies with scripts.

bun pm trust

Trust dependencies and allow their install scripts to run.
Trust all untrusted dependencies:

bun pm default-trusted

Print the default list of trusted dependencies.

Global flags

These flags work with most bun pm commands:

--json

Output in JSON format (where applicable).

--verbose

Enable verbose logging.

--silent

Suppress output except errors.

Examples

Check package manager health

Clean workspace

Inspect dependencies