skills/bun-pm-lockfile/SKILL.md
Bun's lockfile format and configuration
npx skillsauth add jarle/bun-skills Bun LockfileInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Bun's lockfile format and configuration
Running bun install will create a lockfile called bun.lock.
Yes
To generate a lockfile without installing to node_modules you can use the --lockfile-only flag. The lockfile will always be saved to disk, even if it is up-to-date with the package.json(s) for your project.
bun install --lockfile-only
<Note>
Using `--lockfile-only` will still populate the global install cache with registry metadata and git/tarball
dependencies.
</Note>
To install without creating a lockfile:
bun install --no-save
To install a Yarn lockfile in addition to bun.lock.
[install.lockfile]
# whether to save a non-Bun lockfile alongside bun.lock
# only "yarn" is supported
print = "yarn"
</CodeGroup>
Bun v1.2 changed the default lockfile format to the text-based bun.lock. Existing binary bun.lockb lockfiles can be migrated to the new format by running bun install --save-text-lockfile --frozen-lockfile --lockfile-only and deleting bun.lockb.
More information about the new lockfile format can be found on our blogpost.
When running bun install in a project without a bun.lock, Bun automatically migrates existing lockfiles:
yarn.lock (v1)package-lock.json (npm)pnpm-lock.yaml (pnpm)The original lockfile is preserved and can be removed manually after verification.
development
Using TypeScript with Bun, including type definitions and compiler options
development
Learn how to write tests using Bun's Jest-compatible API with support for async tests, timeouts, and various test modifiers
testing
Learn how to use snapshot testing in Bun to save and compare output between test runs
testing
Learn about Bun test's runtime integration, environment variables, timeouts, and error handling