Skip to content
Latchkey

SvelteKit "Cannot find package '@sveltejs/adapter-node'" in CI

svelte.config.js imports an adapter (@sveltejs/adapter-node, -static, -vercel) and Node cannot resolve it. The adapter package is simply not present in node_modules on the runner.

What this error means

The build aborts while loading svelte.config.js with "Cannot find package '@sveltejs/adapter-node'" or a matching module-not-found for whichever adapter is imported.

node
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sveltejs/adapter-node'
imported from /home/runner/work/app/app/svelte.config.js

Common causes

The adapter is not in package.json

The config imports an adapter that was never added as a dependency, so a clean install in CI has nothing to resolve.

Dev dependencies were pruned

The adapter is a devDependency that a production-only install removed, leaving the import unresolved at build time.

How to fix it

Install the adapter the config imports

  1. Read which adapter svelte.config.js imports.
  2. Add that exact package to dependencies.
  3. Run a full install before the build.
Terminal
npm install -D @sveltejs/adapter-node
npm run build

Keep dev dependencies during the build

Use npm ci (full install) so the devDependency adapter is present when the config loads.

.github/workflows/ci.yml
- run: npm ci
- run: npm run build

How to prevent it

  • Add the chosen adapter to package.json and commit the lockfile.
  • Use a full install in the build job, not production-only.
  • Keep the adapter import in svelte.config.js matched to an installed package.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →