Skip to content

bun add CLI Usage

bash
bun add <package> <@version>

Dependency Management

--productionboolean
Don't install devDependencies. Alias: -p
--omitstring
Exclude dev, optional, or peer dependencies from install
--globalboolean
Install globally. Alias: -g
--devboolean
Add dependency to devDependencies. Alias: -d
--optionalboolean
Add dependency to optionalDependencies
--peerboolean
Add dependency to peerDependencies
--exactboolean
Add the exact version instead of the ^ range. Alias: -E
--only-missingboolean
Only add dependencies to package.json if they are not already present

Project Files & Lockfiles

--yarnboolean
Write a yarn.lock file (yarn v1). Alias: -y
--no-saveboolean
Don't update package.json or save a lockfile
--saveboolean default: true
Save to package.json (true by default)
--frozen-lockfileboolean
Disallow changes to lockfile
--trustboolean
Add to trustedDependencies in the project's package.json and install the package(s)
--save-text-lockfileboolean
Save a text-based lockfile
--lockfile-onlyboolean
Generate a lockfile without installing dependencies

Installation Control

--dry-runboolean
Don't install anything
--forceboolean
Always request the latest versions from the registry & reinstall all dependencies. Alias: -f
--no-verifyboolean
Skip verifying integrity of newly downloaded packages
--ignore-scriptsboolean
Skip lifecycle scripts in the project's package.json (dependency scripts are never run)
--analyzeboolean
Recursively analyze & install dependencies of files passed as arguments (using Bun's bundler). Alias:{" "} -a

Network & Registry

--castring
Provide a Certificate Authority signing certificate
--cafilestring
Same as --ca, but as a file path to the certificate
--registrystring
Use a specific registry by default, overriding .npmrc, bunfig.toml, and environment variables
--network-concurrencynumber default: 48
Maximum number of concurrent network requests (default 48)

Performance & Resource

--backendstring default: clonefile
Platform-specific optimizations for installing dependencies. Possible values: clonefile (default),{" "} hardlink, symlink, copyfile
--concurrent-scriptsnumber default: 5
Maximum number of concurrent jobs for lifecycle scripts (default 5)

Caching

--cache-dirstring
Store & load cached data from a specific directory path
--no-cacheboolean
Ignore manifest cache entirely

Output & Logging

--silentboolean
Don't log anything
--verboseboolean
Excessively verbose logging
--no-progressboolean
Disable the progress bar
--no-summaryboolean
Don't print a summary

Global Configuration & Context

--configstring
Specify path to config file (bunfig.toml). Alias: -c
--cwdstring
Set a specific current working directory

Help

--helpboolean
Print this help menu. Alias: -h