{"record":{"id":"f3bef50a1d59c189","repo":"sveltejs/kit","slug":"could-not-install-match-module-please-install","errorCode":null,"errorMessage":"Could not install ${match.module}. Please install it yourself by adding it to your package.json's devDependencies and try building your project again.","messagePattern":"Could not install (.+?)\\. Please install it yourself by adding it to your package\\.json's devDependencies and try building your project again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-auto/index.js","lineNumber":118,"sourceCode":"\t\ttry {\n\t\t\tconsole.log(`Installing ${match.module}...`);\n\n\t\t\texecSync(command, {\n\t\t\t\tstdio: 'inherit',\n\t\t\t\tenv: {\n\t\t\t\t\t...process.env,\n\t\t\t\t\tNODE_ENV: undefined\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tresolved = resolve_peer(match.module);\n\n\t\t\tconsole.log(`Successfully installed ${match.module}.`);\n\t\t\tconsole.warn(\n\t\t\t\t`\\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`\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tthrow new Error(\n\t\t\t\t`Could not install ${match.module}. Please install it yourself by adding it to your package.json's devDependencies and try building your project again.`,\n\t\t\t\t{ cause: e }\n\t\t\t);\n\t\t}\n\t}\n\n\t/** @type {{ default: () => Adapter }} */\n\tconst module = await import(pathToFileURL(resolved).href);\n\n\tconst adapter = module.default();\n\n\treturn {\n\t\t...adapter,\n\t\tadapt: (builder) => {\n\t\t\tbuilder.log.info(`Detected environment: ${match.name}. Using ${match.module}`);\n\t\t\treturn adapter.adapt(builder);\n\t\t}\n\t};","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-auto/index.js#L100-L136","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Install the adapter manually: npm i -D @sveltejs/<adapter> (check the `cause` of the error for the underlying install failure).","Check network/registry access in CI and configure registry auth if using a private registry.","Ensure a supported package manager is available on PATH, or set the environment so the correct one is used.","Replace adapter-auto with the concrete adapter in svelte.config.js so no runtime install is attempted."],"exampleFix":"// before\n// adapter-auto attempts automatic install during build\n// after\n// terminal: npm i -D @sveltejs/adapter-vercel\n// svelte.config.js\nimport adapter from '@sveltejs/adapter-vercel';\nexport default { kit: { adapter: adapter() } };","handlingStrategy":"try-catch","validationCode":"import { execSync } from 'node:child_process';\ntry { execSync('npm ping', { stdio: 'ignore' }); } catch { throw new Error('Registry unreachable — install the adapter ahead of the build'); }","typeGuard":"const canAutoInstall = () => ['npm','pnpm','yarn','bun'].some((pm) => {\n  try { execSync(`${pm} --version`, { stdio: 'ignore' }); return true; } catch { return false; }\n});","tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  if (/Could not install .+ Please install it yourself/.test(e.message)) {\n    console.error('Auto-install failed. Underlying cause:', e.cause);\n    console.error('Fix: npm i -D @sveltejs/<adapter-for-your-platform>');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Pre-install the concrete adapter so auto-install never runs","Check e.cause for the real package-manager failure","Ensure registry credentials/network are configured in CI","Keep a supported package manager on the build image"],"tags":["auto-install","adapter-auto","package-manager","ci"],"backgroundTag":"package-install-failed","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}