ionic-team/ionic-framework · error · SchematicsException

Could not find (${path})

Error message

Could not find (${path})

What it means

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.

Source

Thrown at packages/angular/src/schematics/utils/config.ts:146

  }

  angularJson.schematics[schematicName] = schematicOpts;

  writeConfig(host, angularJson);
}

export function getWorkspacePath(host: Tree): string {
  const possibleFiles = ['/angular.json', '/.angular.json'];
  const path = possibleFiles.filter((path) => host.exists(path))[0];

  return path;
}

export function getWorkspace(host: Tree): WorkspaceDefinition {
  const path = getWorkspacePath(host);
  const configBuffer = host.read(path);
  if (configBuffer === null) {
    throw new SchematicsException(`Could not find (${path})`);
  }
  const content = configBuffer.toString();

  return parse(content) as WorkspaceDefinition;
}

View on GitHub (pinned to 625f9c38ad)

Solutions

  1. Confirm you are in an Angular CLI project: list the directory and check for `angular.json`.
  2. If the file was renamed/moved, restore or symlink `angular.json` at the workspace root.
  3. Run the schematic from the folder that actually contains angular.json.
  4. For NX or non-standard workspaces, use the framework-specific integration (e.g. @ionic/angular with NX plugin) instead of the stock schematic.

Example fix

// before: schematic run in a folder with no angular.json
ng add @ionic/angular
// after: move to the folder containing angular.json, then run
ls angular.json   # confirm presence
ng add @ionic/angular
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'fs';
if (!existsSync('angular.json') && !existsSync('.angular.json')) {
  throw new Error('No Angular workspace file found. Run this schematic inside an Angular CLI project.');
}

Type guard

function hasAngularWorkspace(files: string[]): boolean {
  return files.includes('angular.json') || files.includes('.angular.json');
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of ionic-team/ionic-framework@625f9c38ad (2026-08-12). Data as JSON: /api/errors/1671134f5953a485. Report an issue: GitHub.