{"record":{"id":"1671134f5953a485","repo":"ionic-team/ionic-framework","slug":"could-not-find-path","errorCode":null,"errorMessage":"Could not find (${path})","messagePattern":"Could not find \\((.+?)\\)","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/angular/src/schematics/utils/config.ts","lineNumber":146,"sourceCode":"  }\n\n  angularJson.schematics[schematicName] = schematicOpts;\n\n  writeConfig(host, angularJson);\n}\n\nexport function getWorkspacePath(host: Tree): string {\n  const possibleFiles = ['/angular.json', '/.angular.json'];\n  const path = possibleFiles.filter((path) => host.exists(path))[0];\n\n  return path;\n}\n\nexport function getWorkspace(host: Tree): WorkspaceDefinition {\n  const path = getWorkspacePath(host);\n  const configBuffer = host.read(path);\n  if (configBuffer === null) {\n    throw new SchematicsException(`Could not find (${path})`);\n  }\n  const content = configBuffer.toString();\n\n  return parse(content) as WorkspaceDefinition;\n}\n","sourceCodeStart":128,"sourceCodeEnd":152,"githubUrl":"https://github.com/ionic-team/ionic-framework/blob/625f9c38ad8c5db8a6c12df5c1622a36da90f9e3/packages/angular/src/schematics/utils/config.ts#L128-L152","documentation":"Thrown by getWorkspace() when host.read(path) returns null for the workspace file path. getWorkspacePath() returns the first existing of `/angular.json` or `/.angular.json`; if neither exists, `path` is `undefined` and the read fails. This is the schematic's way of saying it could not locate an Angular CLI workspace at the expected root location.","triggerScenarios":"Running an Ionic Angular schematic in a directory whose virtual Tree contains no `angular.json` and no `.angular.json` at the filesystem root the schematic reads. `path` in the message will be `undefined` when neither file is present.","commonSituations":"Running `ng add @ionic/angular` outside an Angular CLI project; inside an NX/non-Angular monorepo where the workspace file is named differently (workspace.json, project.json); angular.json was deleted, renamed, or lives in a sub-package and the schematic ran from the wrong root.","solutions":["Confirm you are in an Angular CLI project: list the directory and check for `angular.json`.","If the file was renamed/moved, restore or symlink `angular.json` at the workspace root.","Run the schematic from the folder that actually contains angular.json.","For NX or non-standard workspaces, use the framework-specific integration (e.g. @ionic/angular with NX plugin) instead of the stock schematic."],"exampleFix":"// before: schematic run in a folder with no angular.json\nng add @ionic/angular\n// after: move to the folder containing angular.json, then run\nls angular.json   # confirm presence\nng add @ionic/angular","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nif (!existsSync('angular.json') && !existsSync('.angular.json')) {\n  throw new Error('No Angular workspace file found. Run this schematic inside an Angular CLI project.');\n}","typeGuard":"function hasAngularWorkspace(files: string[]): boolean {\n  return files.includes('angular.json') || files.includes('.angular.json');\n}","tryCatchPattern":null,"preventionTips":["Confirm angular.json exists at the directory you invoke the schematic from.","Do not rename angular.json; if you must, restore it before running schematics.","Use the framework-specific integration for NX or non-standard workspaces."],"tags":["angular","schematics","configuration","workspace"],"backgroundTag":null,"analyzedSha":"625f9c38ad8c5db8a6c12df5c1622a36da90f9e3","analyzedAt":"2026-08-12T16:00:25.413Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}