{"record":{"id":"28d242fc198c86c3","repo":"sveltejs/kit","slug":"unsupported-bun-version-major-please-use-bun","errorCode":null,"errorMessage":"Unsupported Bun version: ${major}. Please use Bun 1.x to build your project, or explicitly specify a runtime in your adapter configuration.","messagePattern":"Unsupported Bun version: (.+?)\\. Please use Bun 1\\.x to build your project, or explicitly specify a runtime in your adapter configuration\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-vercel/utils.js","lineNumber":81,"sourceCode":" * @param {string | undefined} [override_key]\n * @returns {RuntimeKey}\n */\nexport function resolve_runtime(default_key, override_key) {\n\tconst key = override_key ?? default_key ?? get_default_runtime();\n\tassert_is_valid_runtime(key);\n\treturn key;\n}\n\nconst valid_node_versions = [22, 24];\nconst formatter = new Intl.ListFormat('en-gb', { type: 'disjunction' });\n\n/** @returns {RuntimeKey} */\nfunction get_default_runtime() {\n\t// if the user ran e.g. `bunx --bun vite build`, infer that they want to run the app in Bun\n\tif (process.versions.bun) {\n\t\tconst major = process.versions.bun.split('.')[0];\n\t\tif (major !== '1') {\n\t\t\tthrow new Error(\n\t\t\t\t`Unsupported Bun version: ${major}. Please use Bun 1.x to build your project, or explicitly specify a runtime in your adapter configuration.`\n\t\t\t);\n\t\t}\n\n\t\treturn `bun${major}.x`;\n\t}\n\n\t// otherwise, default to the version of Node specified in the project config\n\tif (process.versions.node) {\n\t\tconst major = Number(process.versions.node.split('.')[0]);\n\n\t\tif (!valid_node_versions.includes(major)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Unsupported Node.js version: ${process.version}. Please use Node ${formatter.format(valid_node_versions.map((v) => `${v}`))} to build your project, or explicitly specify a runtime in your adapter configuration.`\n\t\t\t);\n\t\t}\n\n\t\treturn `nodejs${/** @type {22 | 24} */ (major)}.x`;","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-vercel/utils.js#L63-L99","documentation":"When no explicit runtime is configured, adapter-vercel infers one from the build environment. If the build ran under Bun with a major version other than 1, the adapter cannot map it to a supported Vercel Bun runtime and throws, asking for Bun 1.x or an explicit runtime.","triggerScenarios":"Running the build with a non-1.x Bun (process.versions.bun starts with '2' or higher, e.g. via `bunx --bun vite build`) while the adapter config omits `runtime`.","commonSituations":"Newly released Bun 2.x used out of habit with bunx; CI image upgraded Bun; team member builds with `bun run build` where the script invokes bun directly.","solutions":["Build with Bun 1.x (`bunx --bun vite build` with Bun 1 installed) or with Node instead","Explicitly set the runtime in svelte.config.js, e.g. `vercel({ runtime: 'nodejs22.x' })` or `'bun1.x'`, so inference is skipped","Pin Bun 1.x in CI (e.g. oven-sh/setup-bun@v1 with bun-version: 1)","Downgrade via the bun version manager if Bun 2 is installed locally"],"exampleFix":"// before\nexport default adapter(); // built with Bun 2.x\n// after\nexport default adapter({ runtime: 'nodejs22.x' });","handlingStrategy":"fallback","validationCode":"if (process.versions.bun && !process.versions.bun.startsWith('1.')) {\n  console.warn('Bun != 1.x; specify adapter runtime explicitly or build with Bun 1/Node');\n}","typeGuard":"const isBun1 = () => typeof process.versions.bun === 'string' && process.versions.bun.startsWith('1.');","tryCatchPattern":"try {\n  await build();\n} catch (err) {\n  if (err.message.includes('Unsupported Bun version')) {\n    console.error('Use Bun 1.x for the build or set adapter runtime explicitly.');\n  }\n  throw err;\n}","preventionTips":["Pin Bun 1.x in CI and devcontainer images","Prefer Node for builds unless Bun runtime is intended","Always set an explicit runtime in adapter options for reproducible builds","Check `bun --version` in build scripts before invoking vite"],"tags":["vercel","bun","versioning","build"],"backgroundTag":"unsupported-runtime-version","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}