cypress-io/cypress · error · Error
Unexpected major version of ${json.name}. Cypress webpack-de
Error message
Unexpected major version of ${json.name}. Cypress webpack-dev-server works with ${json.name} versions ${acceptedVersions.join(', ')} - saw ${json.version} What it means
Thrown by getMajorVersion in sourceRelativeWebpackModules.ts. When sourcing webpack, webpack-dev-server, or html-webpack-plugin relative to the user's project, Cypress reads each package's package.json, parses the version, takes the leading number as the major, and verifies it falls inside an explicit acceptedVersions list. Any major outside that allowlist is rejected because Cypress's webpack config merge logic is major-version-specific (e.g. html-webpack-plugin v4 vs v5 have incompatible option shapes).
Source
Thrown at npm/webpack-dev-server/src/sourceRelativeWebpackModules.ts:283
View on GitHub (pinned to 0d85fdc912)
Solutions
- Read the error: it names the package and the accepted majors (e.g. 'works with html-webpack-plugin versions 4, 5 - saw 6.0.0').
- Downgrade (or upgrade) the offending package to a major in the acceptedVersions list: `npm install --save-dev html-webpack-plugin@5`.
- Run `npm ls <package>` to detect duplicate installations and resolve hoisting conflicts.
- If you must use an unsupported major, open an issue / PR against @cypress/webpack-dev-server to extend acceptedVersions.
Example fix
// before "html-webpack-plugin": "^6.0.0" // after "html-webpack-plugin": "^5.5.0"
Defensive patterns
Strategy: validation
Validate before calling
function checkMajorVersion (pkgJsonPath: string, accepted: number[]) {
const { name, version } = require(pkgJsonPath)
const major = Number(version.split('.')[0])
if (!accepted.includes(major)) {
throw new Error(`${name}@${version} unsupported; accepted majors: ${accepted.join(', ')}`)
}
} Type guard
function isAcceptedMajor (version: string, accepted: number[]): boolean {
return accepted.includes(Number(version.split('.')[0]))
} Prevention
- Pin webpack, webpack-dev-server, and html-webpack-plugin to Cypress-supported majors.
- Run `npm ls <pkg>` to detect duplicates after install.
- Read Cypress release notes when upgrading bundler deps.
When it happens
Trigger: Installing a newer or older major of webpack, webpack-dev-server, or html-webpack-plugin than Cypress supports. For example html-webpack-plugin 6.x (only 4 and 5 are accepted) or webpack 6.x. The error message names the offending package and the accepted list, so it is self-diagnosing.
Common situations: Running `npm install webpack@latest` ahead of Cypress support, mixed majors in a monorepo where hoisting pulls the wrong version, or upgrading a starter template that pulls newer majors.
Related errors
- Unsupported webpackDevServer version ${webpackDevServerMajor
- Failed to load "next/dist/build/webpack-config" with error:
- Failed to load "next/dist/build/load-jsconfig" with error: $
- Failed to load "next/dist/build/utils" with error: ${ e.mess
- CJS builds of vite ${majorVersionNumber} are not supported
AI-assisted analysis of cypress-io/cypress@0d85fdc912 (2026-08-12).
Data as JSON: /api/errors/1847da70770f864d.
Report an issue: GitHub.