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
General Configuration
Specify path to config file (bunfig.toml)
Lockfile 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
Dependency Management
Don't install devDependencies
Always request the latest versions from the registry & reinstall all dependencies
Skip lifecycle scripts in the project's package.json (dependency scripts are never run)
Add to trustedDependencies in the project's package.json and install the package(s)
Exclude 'dev', 'optional', or 'peer' dependencies from install
Update packages to their latest versions
Caching and Performance
Store & load cached data from a specific directory path
Ignore manifest cache entirely
--concurrent-scripts=<val>
Maximum number of concurrent jobs for lifecycle scripts (default 5)
--network-concurrency=<val>
Maximum number of concurrent network requests (default 48)
Registry and Authentication
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
Output and Logging
Excessively verbose logging
Verification and Integrity
Skip verifying integrity of newly downloaded packages
Miscellaneous
Platform-specific optimizations for installing dependencies. Possible values: "clonefile" (default), "hardlink", "symlink", "copyfile"
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