withastro/astro · warning

The local Node.js version

Error message

	The local Node.js version (${major}) is not supported by Vercel Serverless Functions.
	Your project will use Node.js 24 as the runtime instead.
	Consider switching your local version to 24.

What it means

While generating per-function .vc-config.json files, the Vercel adapter maps the local Node.js major version to a Vercel serverless runtime via SUPPORTED_NODE_VERSIONS. If the major running the build is not a key in that table (e.g. an odd-numbered, very new, or EOL-and-removed release), getRuntime() warns and pins the deployed functions to nodejs24.x instead, so production runtime differs from your local one.

Solutions

  1. Switch the build environment to Node 24 (matching the fallback runtime): use a .nvmrc / .node-version file with '24' or update the CI image (e.g. actions/setup-node with node-version: 24).
  2. Upgrade @astrojs/vercel if a newer release added support for your Node major.
  3. Pin engines.node in package.json (e.g. ">=24") so the toolchain fails loudly instead of silently deploying a different runtime.
  4. Rebuild; the warning disappears and local and deployed runtimes match.

Example fix

# before
# .nvmrc
20.11.0

# after
# .nvmrc
24
Defensive patterns

Strategy: validation

Validate before calling

const major = Number(process.versions.node.split('.')[0]);
const SUPPORTED = [20, 22, 24]; // keep in sync with @astrojs/vercel
if (!SUPPORTED.includes(major)) {
  throw new Error(
    `Node ${major} is not a supported Vercel serverless runtime; switch to 24 or update @astrojs/vercel`,
  );
}

Prevention

When it happens

Trigger: Running astro build with the Vercel adapter on a Node major absent from SUPPORTED_NODE_VERSIONS (for example Node 21 or a newly released major not yet added to the adapter). support === undefined, the warning prints, and getRuntime returns 'nodejs24.x'.

Common situations: CI images or local toolchains pinned to non-LTS or bleeding-edge Node; building in Docker with an exotic Node tag; after Vercel drops an old major (e.g. 16/18) from the support table, older build images start hitting this; version-dependent dependencies (native modules, Intl behavior) behaving differently locally vs deployed.

Related errors


AI-assisted analysis of withastro/astro@3578d45d34 (2026-08-18). Data as JSON: /api/errors/b3f0d993c8d627fc. Report an issue: GitHub.

Appendix: source

Thrown at packages/integrations/vercel/src/index.ts:792

			new URL('./middleware.mjs', functionFolder),
			middlewareSecret,
			this.logger,
			isrForwarding,
		);

		await writeJson(new URL(`./.vc-config.json`, functionFolder), {
			runtime: 'edge',
			entrypoint: 'middleware.mjs',
		});
	}
}

function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Runtime {
	const version = process.version.slice(1); // 'v18.19.0' --> '18.19.0'
	const major = version.split('.')[0]; // '18.19.0' --> '18'
	const support = SUPPORTED_NODE_VERSIONS[major];
	if (support === undefined) {
		logger.warn(
			`\n` +
				`\tThe local Node.js version (${major}) is not supported by Vercel Serverless Functions.\n` +
				`\tYour project will use Node.js 24 as the runtime instead.\n` +
				`\tConsider switching your local version to 24.\n`,
		);
		return 'nodejs24.x';
	}
	if (support.status === 'default' || support.status === 'available') {
		return `nodejs${major}.x`;
	}
	if (support.status === 'retiring') {
		if (support.warnDate && new Date() >= support.warnDate) {
			logger.warn(
				`Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.`,
			);
		}
		return `nodejs${major}.x`;
	}

View on GitHub (pinned to 3578d45d34)