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.

Diagnose it: is it resolution, transform, or memory?

Bundler failures in CI fall into three families and the error text often points at the wrong one. A module that resolves on your machine and not on the runner is nearly always case sensitivity or a missing optional dependency; a transform error is a config or version mismatch; and an unexplained kill with no stack is the out-of-memory reaper, not a build error at all.

Terminal
# 1. resolution: does the file exist with EXACTLY that case?
git ls-files | grep -i "the/imported/path"

# 2. transform: what versions is CI actually resolving?
npm ls webpack vite rollup esbuild typescript 2>/dev/null | head -20

# 3. memory: was it killed rather than failed?
#    exit 137 = SIGKILL (OOM). Nothing in the bundler log will explain it.
node --max-old-space-size=4096 node_modules/.bin/vite build

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.

Make the build reproducible before you debug it

  • Pin the Node major in setup-node and in engines. A bundler that resolves native bindings will pick a different prebuilt binary across majors.
  • Delete node_modules locally and reinstall from the lockfile before concluding the runner is at fault; most "works locally" reports are stale local state.
  • Set CI=true locally to reproduce. Several toolchains change behaviour under it, including treating warnings as errors.
  • Exit code 137 is an out-of-memory kill. Raise --max-old-space-size or move to a larger runner rather than searching the bundler config.

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 "Cannot find adapter" / "No adapter specified"?
There are 2 common causes: adapter-auto cannot detect the environment and adapter not installed or wrong for the target. adapter-auto only recognizes a fixed set of hosts.
How do I fix SvelteKit "Cannot find adapter" / "No adapter specified"?
There are 2 fixes depending on which cause you have: install and pin an explicit adapter and match the adapter to the route requirements. Work through them in order, since the first is the most common.
What does SvelteKit "Cannot find adapter" / "No adapter specified" actually mean?
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.
How do I stop SvelteKit "Cannot find adapter" / "No adapter specified" happening again?
Pin an explicit adapter rather than relying on adapter-auto in CI. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card