Skip to content
Latchkey

SvelteKit "Cannot find adapter" / "No adapter specified" - Fix Build

SvelteKit needs an adapter to turn the built app into something a host can run. The build fails (or adapter-auto errors) when no adapter is installed, the configured adapter package is missing, or adapter-auto cannot detect the CI/host environment.

What this error means

A SvelteKit build fails with Cannot find module '@sveltejs/adapter-...', No adapter specified, or an adapter-auto message that it could not detect the deployment target in CI. It happens during the post-vite build adapt phase.

sveltekit output
> 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 choice.

Common causes

adapter-auto cannot detect the environment

adapter-auto only recognizes a fixed set of hosts. In generic CI or a custom host it cannot pick an adapter, so the adapt step fails.

Adapter not installed or wrong for the target

The svelte.config.js references an adapter package that is not in node_modules, or uses adapter-static for a site that needs SSR (or vice versa).

How to fix it

Install and pin an explicit adapter

Replace adapter-auto with the adapter for your actual target and install it.

svelte.config.js
npm install -D @sveltejs/adapter-node
// svelte.config.js
import adapter from '@sveltejs/adapter-node'
export default { kit: { adapter: adapter() } }

Match the adapter to the route requirements

  1. If you have server routes/endpoints, use a server adapter (node, vercel, cloudflare).
  2. For a fully static site, use adapter-static and ensure all routes are prerenderable.
  3. Install the adapter as a dev dependency so a clean npm ci build can find it.

How to prevent it

  • Pin an explicit adapter rather than relying on adapter-auto in CI.
  • Declare the adapter in devDependencies.
  • Match the adapter (static vs server) to your routes' rendering needs.

Frequently asked questions

What causes "SvelteKit adapter error"?
adapter-auto only recognizes a fixed set of hosts. In generic CI or a custom host it cannot pick an adapter, so the adapt step fails.
How do I fix SvelteKit adapter error?
Replace adapter-auto with the adapter for your actual target and install it.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card