bun install creates a lockfile called bun.lock.
Should it be committed to git?
YesGenerate a lockfile without installing?
To generate a lockfile without installing tonode_modules, use the --lockfile-only flag. The lockfile is always saved to disk, even if it is already up to date with your project’s package.json(s).
terminal
--lockfile-only still populates the global install cache with registry metadata and git/tarball dependencies.Can I opt out?
To install without creating a lockfile:terminal
bun.lock:
Text-based lockfile
Bun v1.2 changed the default lockfile format to the text-basedbun.lock. To migrate an existing binary bun.lockb, run bun install --save-text-lockfile --frozen-lockfile --lockfile-only and delete bun.lockb.
For more on the format, see the blog post.
Automatic lockfile migration
When runningbun install in a project without a bun.lock, Bun automatically migrates existing lockfiles:
yarn.lock(v1)package-lock.json(npm)pnpm-lock.yaml(pnpm)