ionic-team/ionic-framework · error · SchematicsException

Ionic Add requires a project type of "application".

Error message

Ionic Add requires a project type of "application".

What it means

Thrown by the `ng add @ionic/angular` schematic (ngAdd) when the resolved Angular workspace project either does not exist or is not of projectType 'application'. Ionic Add bootstraps an Ionic-Angular app shell (builders, styles, app.module wiring) which only makes sense for an application target, so a library (or missing) project is rejected.

Source

Thrown at packages/angular/src/schematics/add/index.ts:211

  };
}

function installNodeDeps() {
  return (_host: Tree, context: SchematicContext) => {
    context.addTask(new NodePackageInstallTask());
  };
}

export default function ngAdd(options: IonAddOptions): Rule {
  return async (host: Tree) => {
    const workspace = await getWorkspace(host);
    if (!options.project) {
      options.project = getDefaultAngularAppName(workspace);
    }
    const project = workspace.projects.get(options.project);

    if (!project || project.extensions.projectType !== 'application') {
      throw new SchematicsException(`Ionic Add requires a project type of "application".`);
    }
    const sourcePath: Path = join(project.sourceRoot as Path);
    const rootTemplateSource = apply(url('./files/root'), [template({ ...options }), move(sourcePath)]);
    return chain([
      // @ionic/angular
      addIonicAngularToPackageJson(),
      addIonicAngularToolkitToPackageJson(),
      addIonicAngularToolkitToAngularJson(),
      addIonicAngularModuleToAppModule(sourcePath),
      addProvideIonicAngular(options.project, sourcePath),
      addIonicBuilder(options.project),
      addIonicStyles(options.project, sourcePath),
      addIonicons(options.project, sourcePath),
      addIonicConfig(sourcePath),
      mergeWith(rootTemplateSource),
      // install freshly added dependencies
      installNodeDeps(),
    ]);

View on GitHub (pinned to 625f9c38ad)

Solutions

  1. Pass the correct application project: `ng add @ionic/angular --project=my-app`.
  2. If the workspace has no application project, create one first (`ng generate application my-app`) then re-run the schematic.
  3. Verify angular.json lists a project with "projectType": "application" and use that name.
  4. Ensure you run the schematic from the Angular workspace root with a valid angular.json.

Example fix

// before
ng add @ionic/angular                // defaults to a library project
ng add @ionic/angular --project=shared-lib

// after
ng add @ionic/angular --project=my-app   // where my-app is projectType 'application'
Defensive patterns

Strategy: validation

Validate before calling

// Validate the project before running the schematic:
function isApplicationProject(project?: { extensions?: { projectType?: string } }): boolean {
  return !!project && project.extensions?.projectType === 'application';
}
// CLI: ng add @ionic/angular --project=<application-project-name>

Prevention

When it happens

Trigger: Running `ng add @ionic/angular` (or `ionic add`) in a workspace where the selected/default project is a library, or where the --project flag names a non-existent project. getDefaultAngularAppName picks the first application, but if none exists or the flag points elsewhere, the guard fires.

Common situations: Monorepo where the default project is a shared library; running the schematic inside a library project; misspelled --project name; workspace whose angular.json has only library projects; running add against a non-Angular CLI workspace.

Related errors


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