{"record":{"id":"50058fa86709b1d8","repo":"cypress-io/cypress","slug":"angular-json-not-found","errorCode":null,"errorMessage":"angular.json not found","messagePattern":"angular\\.json not found","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"npm/cypress-schematic/src/schematics/ng-add/index.ts","lineNumber":314,"sourceCode":"\n        addCypressTsConfig(tree, angularJsonVal, project)\n\n        context.logger.debug(`Adding cypress-run and cypress-open commands in angular.json`)\n\n        addNewCypressCommands(\n          tree,\n          angularJsonVal,\n          project,\n          runJson,\n          openJson,\n          e2eJson,\n          options.e2e,\n          componentJson,\n          options.component,\n        )\n      })\n    } else {\n      throw new SchematicsException('angular.json not found')\n    }\n\n    return tree\n  }\n}\n\nfunction addDefaultSchematic (): Rule {\n  return (tree: Tree, _: SchematicContext) => {\n    if (tree.exists('./angular.json')) {\n      const angularJsonVal = getAngularJsonValue(tree)\n      const angularSchematic = '@schematics/angular'\n      const cli = {\n        ...angularJsonVal.cli,\n        schematicCollections: ['@cypress/schematic', ...angularJsonVal?.cli?.schematicCollections ?? []],\n      }\n\n      if (cli.schematicCollections.indexOf('@schematics/angular') === -1) {\n        cli.schematicCollections.push(angularSchematic)","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/cypress-schematic/src/schematics/ng-add/index.ts#L296-L332","documentation":"Raised by modifyAngularJson() during `ng add @cypress/schematic` when tree.exists('./angular.json') returns false. The schematic only knows how to register Cypress targets inside an existing angular.json; without it there is nothing to modify, so it throws a SchematicsException instead of silently skipping.","triggerScenarios":"Running `ng add @cypress/schematic` from a directory that does not contain an angular.json file (e.g. a subdirectory, a non-Angular project, or a workspace where the file was renamed/deleted).","commonSituations":"Wrong working directory (running from a packages/subdir instead of the workspace root); a project that uses a different config file name; angular.json accidentally gitignored or removed; an Nx workspace using workspace.json instead.","solutions":["`cd` to the directory that contains angular.json (usually the Angular workspace root) and re-run `ng add @cypress/schematic`.","If angular.json is missing entirely, scaffold a standard Angular workspace with `ng new` first.","If the file was renamed or moved, restore it to the workspace root before running the schematic.","For Nx workspaces, confirm you are running an Angular CLI schematic against an Angular-style angular.json."],"exampleFix":"# before: run from a subdir with no angular.json\n# after:\ncd /path/to/angular/workspace-root\nng add @cypress/schematic","handlingStrategy":"validation","validationCode":"import fs from 'fs'\n\nif (!fs.existsSync('./angular.json')) {\n  throw new Error('No angular.json found in the current directory. Run ng add @cypress/schematic from the Angular workspace root.')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run Angular schematics from the workspace root that contains angular.json.","Verify angular.json exists before invoking `ng add @cypress/schematic`.","Create the Angular workspace with `ng new` if starting fresh."],"tags":["angular","schematic","ng-add","angular-json"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}