{"record":{"id":"35d747d7bc5916c0","repo":"cypress-io/cypress","slug":"cannot-find-version-for-component-componentname","errorCode":null,"errorMessage":"Cannot find version for component \"${componentName}\" under property \"${name}\"","messagePattern":"Cannot find version for component \"(.+?)\" under property \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/lib/cli.ts","lineNumber":204,"sourceCode":"    logger.always('Bundled Node version:', versions.electronNodeVersion)\n  }\n\n  const reportComponentVersion = (componentName: string, versions: any): void => {\n    const names: any = {\n      package: 'package',\n      binary: 'binary',\n      electron: 'electronVersion',\n      node: 'electronNodeVersion',\n    }\n\n    if (!names[componentName]) {\n      throw new Error(`Unknown component name \"${componentName}\"`)\n    }\n\n    const name = names[componentName]\n\n    if (!versions[name]) {\n      throw new Error(`Cannot find version for component \"${componentName}\" under property \"${name}\"`)\n    }\n\n    const version = versions[name]\n\n    logger.always(version)\n  }\n\n  const defaultVersions = {\n    package: undefined,\n    binary: undefined,\n    electronVersion: undefined,\n    electronNodeVersion: undefined,\n  }\n\n  try {\n    const versions = (await versionModule.getVersions()) || defaultVersions\n\n    if (opts?.component) {","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/cli/lib/cli.ts#L186-L222","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before: cypress version --component binary  -> Cannot find version for component\n# after:\ncypress install\ncypress version --component binary","handlingStrategy":"validation","validationCode":"// Before calling a version-component lookup, confirm the binary is installed:\nconst state = require('cypress/lib/tasks/state').default\nconst binaryDir = state.getBinaryDir()\nconst pkg = await state.getBinaryPkgAsync(binaryDir)\nif (!pkg) {\n  throw new Error('Cypress binary not installed; run `cypress install` first.')\n}","typeGuard":"function hasVersion(v: unknown): v is string {\n  return typeof v === 'string' && v.length > 0\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","version","install","binary"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}