You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A fresh Bun zero-install scaffold cannot start the dev server. Reproduced live with the just-released cli@0.10.26:
bun add -g webjsdev # webjsdev@0.10.26
bun create webjs my-app # scaffolds fine, skips install (zero-install)
cd my-app && bun run dev
# $ bun --bun webjs-bun.mjs dev
# error: ENOENT while resolving package '@webjsdev/server' from
# '/home/vivek/.bun/install/cache/@webjsdev/cli@0.10.26@@@1/bin/webjs.js'
# error: script "dev" exited with code 1
So bun run dev (the most basic command) is broken for a fresh bun zero-install app. bun create worked; the dev server does not.
Root cause (grounded)
bun run dev runs bun --bun webjs-bun.mjs dev, which loads the CLI from the global cache (~/.bun/install/cache/@webjsdev/cli@0.10.26/bin/webjs.js).
webjs.js does a BARE await import('@webjsdev/server') (around L124, L132); the cli's package.json declares @webjsdev/server: ^0.8.0 (a caret RANGE; also @webjsdev/mcp: ^0.1.0, @webjsdev/ui: ^0.3.1).
Under Bun zero-install, a BARE import does NOT honor package.json (the feat: forward inline-safe ranges in the bun zero-install pin rewrite #698 finding), so the ^0.8.0 range is ignored. The global cache even holds @webjsdev/server@0.8.36 (which satisfies ^0.8.0), but bun does not use it for the cli's bare import and does not fetch @webjsdev/server (0.8.37 is published), so it ENOENTs.
The bootstrap must resolve the CLI + its @webjsdev/* deps to concrete versions before any in-process onLoad can help.
Pin the bootstrap chain at generation time. The generated webjs-bun.mjs imports the CLI (and the cli reaches the server) via INLINE-versioned specifiers, so bun auto-install fetches the pinned versions. The cli's bare import('@webjsdev/server') is the hard part: have the cli read its own pinned server version and import('@webjsdev/server@<v>'), or rewrite it as a published-artifact transform.
Make the cli resolve @webjsdev/server via import.meta.resolve against a version it pins internally.
First task: reproduce reliably and determine whether the bare @webjsdev/server auto-install ENOENTs because of (a) the range-ignored-then-latest path, (b) a nested-cache auto-install limitation (a cached package's bare import not triggering project-relative auto-install), or (c) transient fetch flakiness. The fix differs per cause.
Problem
A fresh Bun zero-install scaffold cannot start the dev server. Reproduced live with the just-released cli@0.10.26:
So
bun run dev(the most basic command) is broken for a fresh bun zero-install app.bun createworked; the dev server does not.Root cause (grounded)
bun run devrunsbun --bun webjs-bun.mjs dev, which loads the CLI from the global cache (~/.bun/install/cache/@webjsdev/cli@0.10.26/bin/webjs.js).webjs.jsdoes a BAREawait import('@webjsdev/server')(around L124, L132); the cli's package.json declares@webjsdev/server: ^0.8.0(a caret RANGE; also@webjsdev/mcp: ^0.1.0,@webjsdev/ui: ^0.3.1).^0.8.0range is ignored. The global cache even holds@webjsdev/server@0.8.36(which satisfies^0.8.0), but bun does not use it for the cli's bare import and does not fetch@webjsdev/server(0.8.37 is published), so it ENOENTs.@webjsdev/*imports cannot be pinned by the feat: pin Bun zero-install deps via an onLoad specifier-rewrite from package.json #685 onLoad rewrite, because that onLoad lives INSIDE@webjsdev/server(chicken-and-egg: you cannot pin the import of the very package that hosts the pinner). Likely pre-existing (the cli's dep ranges are unchanged by the recent releases), not a regression from feat: forward inline-safe ranges in the bun zero-install pin rewrite #698/Revert scaffold @webjsdev/* + drizzle exact pins to semver ranges (after #698) #700.Design / approach (candidates, verify empirically)
The bootstrap must resolve the CLI + its
@webjsdev/*deps to concrete versions before any in-process onLoad can help.webjs-bun.mjsimports the CLI (and the cli reaches the server) via INLINE-versioned specifiers, so bun auto-install fetches the pinned versions. The cli's bareimport('@webjsdev/server')is the hard part: have the cli read its own pinned server version andimport('@webjsdev/server@<v>'), or rewrite it as a published-artifact transform.bunfig.toml preload(see Make webjs db/test/typecheck work under bun zero-install (auto-install, no bun install) #704's verifiedbun-pin-preload.js) shipped by the scaffold that rewrites the cli's + bootstrap's bare@webjsdev/*imports to pinned inline specifiers. Verify it loads early enough to catch the cli's import.@webjsdev/serverviaimport.meta.resolveagainst a version it pins internally.First task: reproduce reliably and determine whether the bare
@webjsdev/serverauto-install ENOENTs because of (a) the range-ignored-then-latest path, (b) a nested-cache auto-install limitation (a cached package's bare import not triggering project-relative auto-install), or (c) transient fetch flakiness. The fix differs per cause.Implementation notes (for the implementing agent)
packages/cli/lib/create.js(the generatedwebjs-bun.mjsbootstrap + scaffold bunfig),packages/cli/bin/webjs.js(the bareawait import('@webjsdev/server')), and reusepackages/server/src/bun-pin-preload.js/bun-pin-rewrite.js(Make webjs db/test/typecheck work under bun zero-install (auto-install, no bun install) #704).@webjsdev/serveritself; the fix has to live in the bootstrap, before the server module loads.bun create ... && bun run devboot (no install) that reaches a 200, plus a counterfactual. Bun-only path.Acceptance criteria
bun create ... && bun run devserves a 200 with NObun install.Relates to #704, #695, #698, #669. Likely should be prioritized above #704 (it breaks the basic dev path).