# Bun Generate a yarn-compatible lockfile

> Generate a yarn-compatible lockfile

- Skill: `jarle/bun-generate-a-yarn-compatible-lockfile` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jarle/bun-generate-a-yarn-compatible-lockfile`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jarle/bun-generate-a-yarn-compatible-lockfile/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jarle (https://skillmd.com/u/jarle)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/jarle/bun-generate-a-yarn-compatible-lockfile

---


# Generate a yarn-compatible lockfile

<Note>
  Bun v1.1.39 introduced `bun.lock`, a JSONC formatted lockfile. `bun.lock` is human-readable and git-diffable without
  configuration, at no cost to performance. In 1.2.0+ it is the default format used for new projects. [**Learn
  more.**](/pm/lockfile#text-based-lockfile)
</Note>

***

Use the `--yarn` flag to generate a Yarn-compatible `yarn.lock` file (in addition to `bun.lock{b}`).

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun install --yarn
```

***

To set this as the default behavior, add the following to your `bunfig.toml` file.

```toml bunfig.toml icon="settings" theme={"theme":{"light":"github-light","dark":"dracula"}}
[install.lockfile]
print = "yarn"
```

***

To print a Yarn lockfile to your console without writing it to disk, "run" your `bun.lockb` with `bun`.

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun bun.lockb
```

```txt  theme={"theme":{"light":"github-light","dark":"dracula"}}
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
# bun ./bun.lockb --hash: 9BFBF11D86084AAB-9418b03ff880c569-390CE6459EACEC9A...

abab@^2.0.6:
  version "2.0.6"
  resolved "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz"
  integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvH...
```

***

See [Docs > Package manager](/pm/cli/install) for complete documentation of Bun's package manager.

