rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../index.md)[Package Manager

](../cli/install/index.md)[Bundler

](../../bundler/index.md)[Test Runner

](../../test/index.md)[Guides

](../../guides/index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../feedback/index.md)

Running bun install will create a lockfile called bun.lock.

[​

](#should-it-be-committed-to-git)

Should it be committed to git?

Yes

[​

](#generate-a-lockfile-without-installing)

Generate a lockfile without installing?

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.

terminal

bun install --lockfile-only

Using --lockfile-only will still populate the global install cache with registry metadata and git/tarball dependencies.

[​

](#can-i-opt-out)

Can I opt out?

To install without creating a lockfile:

terminal

bun install --no-save

To install a Yarn lockfile in addition to bun.lock.

bun install --yarn

[​

](#text-based-lockfile)

Text-based lockfile

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.

[​

](#automatic-lockfile-migration)

Automatic lockfile migration

When running bun install in a project without a bun.lock, Bun automatically migrates existing lockfiles:

The original lockfile is preserved and can be removed manually after verification.

Was this page helpful?

Suggest editsRaise issue

[

Isolated installs

Previous

](../isolated-installs/index.md)[

Lifecycle scripts

Next

](../lifecycle/index.md)