package.json and uninstall it.
Behavior
bun remove removes the specified package(s) from package.json and deletes them from node_modules. The lockfile is updated to reflect the changes.
The package is removed from all dependency types:
dependenciesdevDependenciesoptionalDependenciespeerDependencies
Arguments
Package name
Multiple packages
Scoped packages
Flags
--global (-g)
Remove a globally installed package.
--cwd <path>
Run command in specified directory.
--ignore-scripts
Skip running lifecycle scripts (preuninstall, uninstall, postuninstall).
--dry-run
Simulate removing packages without actually uninstalling.
--verbose
Enable verbose logging.
--silent
Suppress all output except errors.
Examples
Remove a single package
Remove multiple packages
Remove dev dependency
Remove with dry run
Lifecycle scripts
When removing a package, Bun runs these lifecycle scripts in order:preuninstall- Before uninstalling the packageuninstall- During package removalpostuninstall- After the package is removed
--ignore-scripts:
Removing unused dependencies
To remove dependencies that are no longer listed inpackage.json, use bun install. This will clean up node_modules: