diff --git a/app/src/cli/commands/run/run.ts b/app/src/cli/commands/run/run.ts index ddfda010..1093e7c5 100644 --- a/app/src/cli/commands/run/run.ts +++ b/app/src/cli/commands/run/run.ts @@ -112,7 +112,14 @@ export async function makeAppFromEnv(options: Partial = {}) { const config = await loadConfigFile(configFilePath); app = await makeConfigApp(config, options.server); } catch (e) { - console.error("Failed to load config:", e); + if (e instanceof ReferenceError && e.message === "Bun is not defined") { + console.error( + c.red("Your config imports from a Bun-specific adapter, but the CLI is running under Node."), + `\nRun with Bun instead:\n\n ${c.cyan("bun node_modules/.bin/bknd")} ${c.dim(process.argv.slice(2).join(" "))}\n`, + ); + } else { + console.error("Failed to load config:", e); + } process.exit(1); } diff --git a/docs/content/docs/(documentation)/usage/cli.mdx b/docs/content/docs/(documentation)/usage/cli.mdx index 838c169e..a34eba32 100644 --- a/docs/content/docs/(documentation)/usage/cli.mdx +++ b/docs/content/docs/(documentation)/usage/cli.mdx @@ -97,6 +97,12 @@ The `app` function is useful if you need a cross-platform way to access the envi TypeScript configuration files (`.ts`) are fully supported and work out of the box with `npx bknd run` — no additional flags or tools required. +If your config imports from a runtime-specific adapter (e.g. `bknd/adapter/bun`), you need to run the CLI with that runtime: + +```sh +bun node_modules/.bin/bknd run +``` + ### Turso/LibSQL database To start an instance with a Turso/LibSQL database, run the following: