Migrating from Bun
Convert a Bun bun.lock or bun.lockb project to LPM CLI with rollback safety.
lpm migrate converts a Bun project to LPM CLI. It writes a version 12 staging lockfile.
By default, an online install then writes version 13 with exact package-instance identities.
This guide covers the Bun-specific parts. For the full flag reference, see lpm migrate.
Prerequisites
- LPM CLI installed - see Installation.
- A
package.jsonplusbun.lockorbun.lockbin the project root. - A clean or committed working tree.
bun.lock is the direct path. When bun.lockb is selected, LPM CLI first looks for a sibling bun.lock; if it exists, LPM CLI parses that text lockfile instead. If no sibling text lockfile exists, LPM CLI runs bun bun.lockb and parses the emitted JSON. If the bun binary is unavailable, migration exits with a clear error.
1. Preview
lpm migrate --dry-runDry-run detects Bun, parses the selected lockfile, converts the graph in memory, and writes nothing. It reports package counts, workspace counts, and any conversion problems before touching disk.
If the project contains multiple lockfiles, LPM CLI chooses the most recently modified one. On timestamp ties, the priority order is bun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock, then package-lock.json.
2. Run The Migration
lpm migrateWhat runs:
- Confirm
package.jsonexists and refuse to overwrite an existinglpm.lockunless--forceis set. - Parse Bun package entries, exact versions, tarball URLs, integrity strings, dependency edges, and dev/optional metadata.
- Write a version 12 staging
lpm.lock. If the graph fits the binary format, writelpm.lockb. - Back up the Bun lockfile,
.npmrcwhen touched,.gitattributes, and any pre-existing LPM CLI lockfiles. - Add LPM CLI registry routing to
.npmrcunless--no-npmrcis set. - If
--no-installis not set, run an onlinelpm install. This step writes version 13 and removes the staging binary file. - Run
build+testscripts unless--skip-verifyis set.
The flow is non-interactive. -y is accepted but reserved for a future interactive mode; it does not imply --force.
3. Verify
If you used --no-install, run lpm install before the offline command.
lpm install --offline
lpm test
lpm lintlpm install --offline confirms the new lockfile and the warmed store can replay without network access. If your Bun project used scripts that shell out through bun, keep Bun installed wherever those scripts run; migration changes the package manager, not your project scripts.
4. Commit
git add lpm.lock .npmrc package.json
test ! -f lpm.lockb || git add lpm.lockb
git rm bun.lock bun.lockb bun.lock.backup bun.lockb.backup .npmrc.backup
git commit -m "Migrate to LPM CLI"Only remove files that exist in your repo. Do not commit .backup files unless you intentionally keep migration rollback artifacts in the repository.
Bun-Specific Notes
bun.lockJSON is parsed directly.bun.lockbneeds either a siblingbun.lockor thebunbinary available during migration.- Bun lockfile metadata carries dev and optional package flags, so the converted lockfile preserves those package classifications.
- The install step rebuilds
node_modules. Single-package projects default to LPM CLI's hoisted v2 layout; workspaces and peer-conflict installs use isolated layout unless you override the linker. - Dependency lifecycle scripts remain denied by default. After migration, run
lpm rebuildandlpm approve-scriptsfor packages that need install-time builds.
Rollback
lpm migrate --rollbackRestores backups from the previous migration run and removes LPM CLI files created by that run. Safe to run repeatedly.
See also
lpm migrate- full flag reference- Migrating from npm - package-lock migration
- Migrating from pnpm - pnpm-specific translations
- Migrating from Yarn - Yarn lockfile migration
- Lockfile - what gets committed and why