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.
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.
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.
- 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.