SvelteKit adapter-auto "Could not detect a supported production environment" in CI
SvelteKit's adapter-auto inspects environment variables to pick a host adapter (Vercel, Netlify, Cloudflare). On a plain CI runner those variables are absent, so it cannot choose an adapter and the build fails.
What this error means
svelte-kit build / vite build fails with "Could not detect a supported production environment. See https://svelte.dev/docs/kit/adapters to learn how to configure your app to run on the platform of your choice".
> Using @sveltejs/adapter-auto
Error: Could not detect a supported production environment. See
https://svelte.dev/docs/kit/adapters to learn how to configure your app to run on
the platform of your choiceCommon causes
adapter-auto cannot identify a generic runner
GitHub Actions and most CI runners are not one of the hosts adapter-auto detects, so it has nothing to map to.
Building for a static or self-hosted target
When the deploy target is static files or a Node server, adapter-auto is the wrong default and must be replaced.
How to fix it
Install and configure an explicit adapter
- Pick the adapter for your real target (static, node, or a host).
- Install it and set it in
svelte.config.js. - Commit both so CI uses the explicit adapter.
npm i -D @sveltejs/adapter-nodeReference the adapter in config
Replace adapter-auto with the explicit adapter for your deploy.
import adapter from '@sveltejs/adapter-node';
export default {
kit: { adapter: adapter() }
};How to prevent it
- Use an explicit adapter that matches your deploy target.
- Reserve adapter-auto for the hosts it actually supports.
- Commit the adapter dependency and config together.