Question
Can a zero-install Bun app (bun create webjs --no-install, then bun run dev / start via the webjs-bun.mjs bootstrap with no node_modules) RESPECT the package.json versions (and ideally bun.lock) instead of fetching latest?
Seed finding (verified this session, fresh cache)
Bun's bun --bun <file> auto-install (the exact zero-install run path) IGNORES both package.json versions AND a committed bun.lock, fetching latest for any bare import not physically in node_modules:
- A package.json pinning zod EXACTLY to
3.22.4 ran zod 4.4.3.
- Keeping a
bun.lock that pinned 3.22.4 (with node_modules deleted) STILL ran 4.4.3.
- Only
bun install (which materializes node_modules) honors the manifest/lockfile.
So the #675 zero-install path runs UNPINNED LATEST deps, a breaking-major hazard. This is why #682 (defaulting bun create to --no-install) was closed, and why #683 corrects the docs to say so plainly. If this research finds a version-respecting mechanism, #682's default-flip becomes viable.
Avenues to investigate (for the agent who picks this up)
- A
bunfig.toml [install] setting, or any Bun flag / env var, that makes auto-install honor the manifest/lockfile rather than fetching latest.
Bun.plugin onResolve: webjs already registers a Bun.plugin for TS-strip + action seeding (packages/server/src/action-seed-bun.js). An onResolve hook could intercept bare specifiers and resolve them to the package.json/bun.lock-pinned version (read the manifest + lockfile at boot, rewrite resolution to the pinned tarball in the cache).
- A lightweight pre-resolve step: on first run, read package.json + bun.lock and warm Bun's global cache at the EXACT versions (without a full
node_modules materialize), so the subsequent auto-install resolves the pinned copies from cache.
- Whether a private registry mirror + a warmed/pinned cache (the sandbox+PaaS direction) is the only robust fix at scale.
- Confirm whether
bun run <script> differs from bun --bun <file> here, and whether a newer Bun version changes the behavior (re-test on the latest Bun).
Cross-references
This is a forward-looking research task. Findings go into this same issue (comments + a curated conclusion in the body), then close it when the research concludes.
Question
Can a zero-install Bun app (
bun create webjs --no-install, thenbun run dev/startvia thewebjs-bun.mjsbootstrap with nonode_modules) RESPECT the package.json versions (and ideallybun.lock) instead of fetchinglatest?Seed finding (verified this session, fresh cache)
Bun's
bun --bun <file>auto-install (the exact zero-install run path) IGNORES both package.json versions AND a committedbun.lock, fetchinglatestfor any bare import not physically innode_modules:3.22.4ran zod4.4.3.bun.lockthat pinned3.22.4(withnode_modulesdeleted) STILL ran4.4.3.bun install(which materializesnode_modules) honors the manifest/lockfile.So the #675 zero-install path runs UNPINNED LATEST deps, a breaking-major hazard. This is why #682 (defaulting bun create to
--no-install) was closed, and why #683 corrects the docs to say so plainly. If this research finds a version-respecting mechanism, #682's default-flip becomes viable.Avenues to investigate (for the agent who picks this up)
bunfig.toml[install]setting, or any Bun flag / env var, that makes auto-install honor the manifest/lockfile rather than fetching latest.Bun.pluginonResolve: webjs already registers aBun.pluginfor TS-strip + action seeding (packages/server/src/action-seed-bun.js). AnonResolvehook could intercept bare specifiers and resolve them to the package.json/bun.lock-pinned version (read the manifest + lockfile at boot, rewrite resolution to the pinned tarball in the cache).node_modulesmaterialize), so the subsequent auto-install resolves the pinned copies from cache.bun run <script>differs frombun --bun <file>here, and whether a newer Bun version changes the behavior (re-test on the latest Bun).Cross-references
module.registerresolve-hook).This is a forward-looking research task. Findings go into this same issue (comments + a curated conclusion in the body), then close it when the research concludes.