sveltejs/kit · error · Error

Could not install ${match.module}. Please install it yoursel

Error message

Could not install ${match.module}. Please install it yourself by adding it to your package.json's devDependencies and try building your project again.

What it means

adapter-auto tried to automatically install the adapter matching the detected environment (via the package manager) and that installation failed. It rethrows with instructions to add the adapter to devDependencies manually, preserving the original error as cause.

Source

Thrown at packages/adapter-auto/index.js:118

		try {
			console.log(`Installing ${match.module}...`);

			execSync(command, {
				stdio: 'inherit',
				env: {
					...process.env,
					NODE_ENV: undefined
				}
			});

			resolved = resolve_peer(match.module);

			console.log(`Successfully installed ${match.module}.`);
			console.warn(
				`\nIf you plan to continue deploying to ${match.name}, consider replacing @sveltejs/adapter-auto with ${match.module}. This will give you faster installs and more control over deployment configuration.\n`
			);
		} catch (e) {
			throw new Error(
				`Could not install ${match.module}. Please install it yourself by adding it to your package.json's devDependencies and try building your project again.`,
				{ cause: e }
			);
		}
	}

	/** @type {{ default: () => Adapter }} */
	const module = await import(pathToFileURL(resolved).href);

	const adapter = module.default();

	return {
		...adapter,
		adapt: (builder) => {
			builder.log.info(`Detected environment: ${match.name}. Using ${match.module}`);
			return adapter.adapt(builder);
		}
	};

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Install the adapter manually: npm i -D @sveltejs/<adapter> (check the `cause` of the error for the underlying install failure).
  2. Check network/registry access in CI and configure registry auth if using a private registry.
  3. Ensure a supported package manager is available on PATH, or set the environment so the correct one is used.
  4. Replace adapter-auto with the concrete adapter in svelte.config.js so no runtime install is attempted.

Example fix

// before
// adapter-auto attempts automatic install during build
// after
// terminal: npm i -D @sveltejs/adapter-vercel
// svelte.config.js
import adapter from '@sveltejs/adapter-vercel';
export default { kit: { adapter: adapter() } };
Defensive patterns

Strategy: try-catch

Validate before calling

import { execSync } from 'node:child_process';
try { execSync('npm ping', { stdio: 'ignore' }); } catch { throw new Error('Registry unreachable — install the adapter ahead of the build'); }

Type guard

const canAutoInstall = () => ['npm','pnpm','yarn','bun'].some((pm) => {
  try { execSync(`${pm} --version`, { stdio: 'ignore' }); return true; } catch { return false; }
});

Try / catch

try {
  await build();
} catch (e) {
  if (/Could not install .+ Please install it yourself/.test(e.message)) {
    console.error('Auto-install failed. Underlying cause:', e.cause);
    console.error('Fix: npm i -D @sveltejs/<adapter-for-your-platform>');
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: get_adapter detected an environment, found no locally installed adapter, attempted an automatic install of match.module with the package manager, and the install command exited non-zero (caught in the catch block).

Common situations: No network access or blocked registry in CI; read-only filesystem or missing write permissions to the project; unsupported/missing package manager (no npm/pnpm/yarn/bun on PATH); private registry auth failures.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/f3bef50a1d59c189. Report an issue: GitHub.