Files
2026-08-27 21:09:14 +00:00

177 lines
5.2 KiB
Plaintext

## CLI Usage
```bash
bun add <package> <@version>
```
### Dependency Management
<ParamField path="--production" type="boolean">
Don't install devDependencies. Alias: <code>-p</code>
</ParamField>
<ParamField path="--omit" type="string">
Exclude <code>dev</code>, <code>optional</code>, or <code>peer</code> dependencies from install
</ParamField>
<ParamField path="--global" type="boolean">
Install globally. Alias: <code>-g</code>
</ParamField>
<ParamField path="--dev" type="boolean">
Add dependency to <code>devDependencies</code>. Alias: <code>-d</code>
</ParamField>
<ParamField path="--optional" type="boolean">
Add dependency to <code>optionalDependencies</code>
</ParamField>
<ParamField path="--peer" type="boolean">
Add dependency to <code>peerDependencies</code>
</ParamField>
<ParamField path="--exact" type="boolean">
Add the exact version instead of the <code>^</code> range. Alias: <code>-E</code>
</ParamField>
<ParamField path="--only-missing" type="boolean">
Only add dependencies to <code>package.json</code> if they are not already present
</ParamField>
<ParamField path="--catalog" type="string">
Add the resolved version to the root <code>package.json</code> catalog and depend on it as <code>catalog:</code>;{" "}
<code>--catalog=NAME</code> targets <code>catalogs.NAME</code>
</ParamField>
<ParamField path="--filter" type="string">
Add the package(s) to the matching workspaces instead of the current package. Alias: <code>-F</code>
</ParamField>
### Project Files & Lockfiles
<ParamField path="--yarn" type="boolean">
Write a <code>yarn.lock</code> file (yarn v1). Alias: <code>-y</code>
</ParamField>
<ParamField path="--no-save" type="boolean">
Don't update <code>package.json</code> or save a lockfile
</ParamField>
<ParamField path="--save" type="boolean" default="true">
Save to <code>package.json</code>
</ParamField>
<ParamField path="--frozen-lockfile" type="boolean">
Disallow changes to lockfile
</ParamField>
<ParamField path="--trust" type="boolean">
Add to <code>trustedDependencies</code> in the project's <code>package.json</code> and install the package(s)
</ParamField>
<ParamField path="--save-text-lockfile" type="boolean">
Save a text-based lockfile
</ParamField>
<ParamField path="--lockfile-only" type="boolean">
Generate a lockfile without installing dependencies
</ParamField>
### Installation Control
<ParamField path="--dry-run" type="boolean">
Resolve the packages but don't install them, update <code>package.json</code>, or save a lockfile (the project's own
lifecycle scripts still run)
</ParamField>
<ParamField path="--force" type="boolean">
Always request the latest versions from the registry &amp; reinstall all dependencies. Alias: <code>-f</code>
</ParamField>
<ParamField path="--no-verify" type="boolean">
Skip verifying integrity of newly downloaded packages
</ParamField>
<ParamField path="--ignore-scripts" type="boolean">
Skip lifecycle scripts for all packages, including the project's <code>package.json</code> and trusted dependencies
</ParamField>
<ParamField path="--analyze" type="boolean">
Recursively analyze &amp; install dependencies of files passed as arguments (using Bun's bundler). Alias:{" "}
<code>-a</code>
</ParamField>
### Network & Registry
<ParamField path="--ca" type="string">
Provide a Certificate Authority signing certificate
</ParamField>
<ParamField path="--cafile" type="string">
Same as <code>--ca</code>, but as a file path to the certificate
</ParamField>
<ParamField path="--registry" type="string">
Use a specific registry by default, overriding <code>.npmrc</code>, <code>bunfig.toml</code>, and environment
variables
</ParamField>
<ParamField path="--network-concurrency" type="number" default="48">
Maximum number of concurrent network requests
</ParamField>
### Performance &amp; Resource
<ParamField path="--backend" type="string">
Platform-specific optimizations for installing dependencies. Possible values: <code>clonefile</code> (default on
macOS), <code>hardlink</code> (default on Linux and Windows), <code>symlink</code>, <code>copyfile</code>
</ParamField>
<ParamField path="--concurrent-scripts" type="number">
Maximum number of concurrent jobs for lifecycle scripts (default: 2x CPU cores)
</ParamField>
### Caching
<ParamField path="--cache-dir" type="string">
Store &amp; load cached data from a specific directory path
</ParamField>
<ParamField path="--no-cache" type="boolean">
Ignore manifest cache entirely
</ParamField>
### Output &amp; Logging
<ParamField path="--silent" type="boolean">
Don't log anything
</ParamField>
<ParamField path="--verbose" type="boolean">
Excessively verbose logging
</ParamField>
<ParamField path="--no-progress" type="boolean">
Disable the progress bar
</ParamField>
<ParamField path="--no-summary" type="boolean">
Don't print a summary
</ParamField>
### Global Configuration &amp; Context
<ParamField path="--config" type="string">
Specify path to config file (<code>bunfig.toml</code>). Alias: <code>-c</code>
</ParamField>
<ParamField path="--cwd" type="string">
Set a specific current working directory
</ParamField>
### Help
<ParamField path="--help" type="boolean">
Print this help menu. Alias: <code>-h</code>
</ParamField>