cypress-io/cypress · error · Error
Cannot find version for component "${componentName}" under p
Error message
Cannot find version for component "${componentName}" under property "${name}" What it means
Raised by reportComponentVersion() when the component name is valid but the corresponding version value on the resolved versions object is falsy (undefined). For example, asking for 'binary' when versions.binary is undefined — which happens when the Cypress binary is not installed or its package.json could not be read, since the binary version comes from the installed binary's bundled package.json.
Source
Thrown at cli/lib/cli.ts:204
logger.always('Bundled Node version:', versions.electronNodeVersion)
}
const reportComponentVersion = (componentName: string, versions: any): void => {
const names: any = {
package: 'package',
binary: 'binary',
electron: 'electronVersion',
node: 'electronNodeVersion',
}
if (!names[componentName]) {
throw new Error(`Unknown component name "${componentName}"`)
}
const name = names[componentName]
if (!versions[name]) {
throw new Error(`Cannot find version for component "${componentName}" under property "${name}"`)
}
const version = versions[name]
logger.always(version)
}
const defaultVersions = {
package: undefined,
binary: undefined,
electronVersion: undefined,
electronNodeVersion: undefined,
}
try {
const versions = (await versionModule.getVersions()) || defaultVersions
if (opts?.component) {View on GitHub (pinned to 0d85fdc912)
Solutions
- Run `cypress install` to fetch the binary, then retry `cypress version --component <name>`.
- Verify CYPRESS_CACHE_FOLDER points at a cache that actually contains the binary, and that the binary's resources/app/package.json is present.
- Run `cypress verify` to smoke-test the installed binary and surface install problems.
- Use `cypress version --component package` (which does not depend on the binary) to confirm the npm package version while you fix the binary install.
Example fix
# before: cypress version --component binary -> Cannot find version for component # after: cypress install cypress version --component binary
Defensive patterns
Strategy: validation
Validate before calling
// Before calling a version-component lookup, confirm the binary is installed:
const state = require('cypress/lib/tasks/state').default
const binaryDir = state.getBinaryDir()
const pkg = await state.getBinaryPkgAsync(binaryDir)
if (!pkg) {
throw new Error('Cypress binary not installed; run `cypress install` first.')
} Type guard
function hasVersion(v: unknown): v is string {
return typeof v === 'string' && v.length > 0
} Prevention
- Run `cypress install` before any command that reads binary/electron/node versions.
- Verify CYPRESS_CACHE_FOLDER points at a populated cache.
- Use --component package as a smoke check that does not require the binary.
When it happens
Trigger: Running `cypress version --component binary` (or electron/node) before the Cypress binary has been installed, or after the cache was wiped, so getVersions() returns an object whose binary/electronVersion/electronNodeVersion fields are undefined.
Common situations: Fresh install where postinstall did not complete (binary download skipped or failed); CYPRESS_CACHE_FOLDER pointing at an empty/wrong location; a partially installed binary missing resources/app/package.json; CI image that installed the npm package without the binary.
Related errors
- Unknown component name "${componentName}"
- Corrupted download Expected downloaded file to have checksu
- Corrupted download Expected downloaded file to have checksu
- Corrupted download Expected downloaded file to have size: $
- Refusing to extract entry outside of destination: ${entry.fi
AI-assisted analysis of cypress-io/cypress@0d85fdc912 (2026-08-12).
Data as JSON: /api/errors/35d747d7bc5916c0.
Report an issue: GitHub.