sveltejs/kit · error · Error

Unsupported Node.js version: ${process.version}. Please use

Error message

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.

What it means

With no explicit runtime configured, adapter-vercel defaults to the runtime matching the Node.js version used to build. Only a fixed set of major versions (currently 22 and 24) maps to supported Vercel Node runtimes; any other major throws listing the valid versions.

Source

Thrown at packages/adapter-vercel/utils.js:94

function get_default_runtime() {
	// if the user ran e.g. `bunx --bun vite build`, infer that they want to run the app in Bun
	if (process.versions.bun) {
		const major = process.versions.bun.split('.')[0];
		if (major !== '1') {
			throw new Error(
				`Unsupported Bun version: ${major}. Please use Bun 1.x to build your project, or explicitly specify a runtime in your adapter configuration.`
			);
		}

		return `bun${major}.x`;
	}

	// otherwise, default to the version of Node specified in the project config
	if (process.versions.node) {
		const major = Number(process.versions.node.split('.')[0]);

		if (!valid_node_versions.includes(major)) {
			throw new Error(
				`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.`
			);
		}

		return `nodejs${/** @type {22 | 24} */ (major)}.x`;
	}

	throw new Error(
		'Could not auto-detect a runtime. Please explicitly specify a runtime in your adapter configuration.'
	);
}

const valid_runtimes = /** @type {const} */ (['nodejs22.x', 'nodejs24.x', 'bun1.x']);

/**
 * @param {string} key
 * @returns {asserts key is RuntimeKey}
 */

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Build with a supported Node major version (22 or 24) — switch via nvm/volta: `nvm use 22`
  2. Pin Node 22 or 24 in CI (actions/setup-node with node-version: 22)
  3. Explicitly specify a runtime in the adapter config, e.g. `vercel({ runtime: 'nodejs22.x' })`, to bypass version inference
  4. Update @sveltejs/adapter-vercel if a newer version supports your Node major

Example fix

// before (CI)
node-version: 20
// after
node-version: 22
// or in svelte.config.js
export default adapter({ runtime: 'nodejs20.x' }); // if supported by your adapter version; else build on Node 22
Defensive patterns

Strategy: fallback

Validate before calling

const validNodeMajors = [22, 24];
const major = Number(process.versions.node.split('.')[0]);
if (!validNodeMajors.includes(major)) {
  console.warn(`Node ${major} not supported by adapter default runtime; pin Node ${validNodeMajors} or set runtime explicitly`);
}

Type guard

const isSupportedNode = (majors = [22, 24]) =>
  majors.includes(Number(process.versions.node.split('.')[0]));

Try / catch

try {
  await build();
} catch (err) {
  if (err.message.includes('Unsupported Node.js version')) {
    console.error('Build on a supported Node major (see message) or set runtime explicitly.');
  }
  throw err;
}

Prevention

When it happens

Trigger: Building with a Node major version not in `valid_node_versions` (e.g. Node 20, 23, or 25) while the adapter config omits `runtime` in utils.js get_default_runtime.

Common situations: Local machine or CI runner uses the system Node (e.g. Node 20 LTS) rather than a supported version; trying out a fresh Node release; Docker image with an unsupported Node tag.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/241b7150b0461986. Report an issue: GitHub.