Skip to content
Latchkey

bun remove: Uninstall a Dependency

bun remove deletes a package from node_modules and removes its entry from package.json and bun.lock.

bun remove is the inverse of bun add. Its CI relevance is mostly that it changes the lockfile, so the commit that runs it must include the updated bun.lock.

What it does

bun remove uninstalls the named package(s), deletes them from node_modules, removes their declaration from the appropriate section of package.json, and rewrites bun.lock to reflect the pruned tree. It also prunes now-unused transitive dependencies.

Common usage

Terminal
bun remove lodash
bun remove --dev @types/lodash
bun remove react react-dom          # multiple at once

Options

FlagWhat it does
<package>...One or more package names to remove
--dev / -dDisambiguate to a devDependency entry
--ignore-scriptsSkip lifecycle scripts
--no-saveRemove from node_modules without editing package.json

In CI

Like bun add, do not run bun remove in a pipeline; it edits the lockfile and breaks reproducible installs. Run it locally, commit both package.json and bun.lock, and let CI install --frozen-lockfile from the result.

Common errors in CI

"error: <package> is not in package.json" means the name is misspelled or already removed; bun remove only touches declared dependencies. If a later build fails with "Cannot find module" after a remove, code still imports the dropped package, which a clean --frozen-lockfile install surfaces immediately.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →