To update all dependencies to the latest version:
To update a specific dependency to the latest version:
By default, bun update
will update to the latest version of a dependency that satisfies the version range specified in your package.json
.
To update to the latest version, regardless of if it's compatible with the current version range, use the --latest
flag:
For example, with the following package.json
:
{
"dependencies": {
"react": "^17.0.2"
}
}
bun update
would update to a version that matches 17.x
.bun update --latest
would update to a version that matches 18.x
or later.
CLI Usage
$bun update <name>@<version>
Flags
Update Strategy
Always request the latest versions from the registry & reinstall all dependencies
Update packages to their latest versions
Dependency Scope
Don't install devDependencies
Exclude 'dev', 'optional', or 'peer' dependencies from install
Project File Management
Write a yarn.lock file (yarn v1)
Don't update package.json or save a lockfile
Save to package.json (true by default)
Disallow changes to lockfile
Save a text-based lockfile
Generate a lockfile without installing dependencies
Network & Registry
Provide a Certificate Authority signing certificate
The same as `--ca`, but is a file path to the certificate
Use a specific registry by default, overriding .npmrc, bunfig.toml and environment variables
--network-concurrency=<val>
Maximum number of concurrent network requests (default 48)
Caching
Store & load cached data from a specific directory path
Ignore manifest cache entirely
Output & Logging
Excessively verbose logging
Script Execution
Skip lifecycle scripts in the project's package.json (dependency scripts are never run)
--concurrent-scripts=<val>
Maximum number of concurrent jobs for lifecycle scripts (default 5)
Installation Controls
Skip verifying integrity of newly downloaded packages
Add to trustedDependencies in the project's package.json and install the package(s)
Platform-specific optimizations for installing dependencies. Possible values: "clonefile" (default), "hardlink", "symlink", "copyfile"
General & Environment
Specify path to config file (bunfig.toml)
Examples
Update all dependencies:
bun update
Update all dependencies to latest:
bun update --latest
Update specific packages:
bun update zod jquery@3
Full documentation is available at https://bun.sh/docs/cli/update.