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.jsCommon 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
- Read which adapter
svelte.config.jsimports. - Add that exact package to dependencies.
- Run a full install before the build.
Terminal
npm install -D @sveltejs/adapter-node
npm run buildKeep 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 buildHow 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.jsmatched to an installed package.
Related guides
Svelte "Cannot find module '@sveltejs/kit'" import in CIFix Svelte "Cannot find module '@sveltejs/kit'" in CI - the kit package is not in node_modules because dev de…
SvelteKit "500" error thrown during prerendering in CIFix SvelteKit "500" errors during prerendering in CI - a page or load function threw while the prerenderer re…
Svelte "vite-plugin-svelte" preprocess failed in CIFix vite-plugin-svelte preprocess failures in CI - a `<style lang="scss">` or `<script lang="ts">` block need…