Cypress Component Testing "dev-server: failed to start" in CI
Cypress component testing spins up a dev server (Vite or Webpack) to mount components. The run aborts at startup when the devServer framework/bundler is mismatched, the project’s build config is not found, or that config fails to compile.
What this error means
Component specs never start: Cypress reports "Cypress failed to start the dev server" with an underlying Vite/Webpack error. E2E specs are unaffected - only component testing, which needs the dev server, fails.
Cypress failed to start the dev server:
Error: Failed to resolve Vite config - could not load
/app/vite.config.ts (framework: 'react', bundler: 'vite')Common causes
Framework/bundler mismatch or missing config
The component.devServer declares a framework/bundler that does not match the project (e.g. bundler: "webpack" with no webpack config, or vite without a resolvable vite.config).
Project build config fails to compile
The Vite/Webpack config the dev server loads throws (a bad plugin, a missing env, a TS error), so the server cannot come up and component testing aborts.
How to fix it
Point devServer at the right framework and config
// cypress.config.ts
import { defineConfig } from 'cypress';
import viteConfig from './vite.config';
export default defineConfig({
component: {
devServer: { framework: 'react', bundler: 'vite', viteConfig },
},
});Fix the underlying build config
- Read the nested Vite/Webpack error Cypress prints under the dev-server failure.
- Confirm the bundler matches your app (vite vs webpack) and the config path resolves.
- Ensure any env the config reads at load time is present in CI.
How to prevent it
- Match
devServer.framework/bundlerto the project’s actual stack. - Reuse the app’s existing Vite/Webpack config for component testing.
- Provide required env for the build config in CI.