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.
> 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.
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
- If you have server routes/endpoints, use a server adapter (node, vercel, cloudflare).
- For a fully static site, use
adapter-staticand ensure all routes are prerenderable. - Install the adapter as a dev dependency so a clean
npm cibuild can find it.
How to prevent it
- Pin an explicit adapter rather than relying on
adapter-autoin CI. - Declare the adapter in
devDependencies. - Match the adapter (static vs server) to your routes' rendering needs.