{"record":{"id":"6a241d2e254586ec","repo":"ionic-team/ionic-framework","slug":"ionic-add-requires-a-project-type-of-application","errorCode":null,"errorMessage":"Ionic Add requires a project type of \"application\".","messagePattern":"Ionic Add requires a project type of \"application\"\\.","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/angular/src/schematics/add/index.ts","lineNumber":211,"sourceCode":"  };\n}\n\nfunction installNodeDeps() {\n  return (_host: Tree, context: SchematicContext) => {\n    context.addTask(new NodePackageInstallTask());\n  };\n}\n\nexport default function ngAdd(options: IonAddOptions): Rule {\n  return async (host: Tree) => {\n    const workspace = await getWorkspace(host);\n    if (!options.project) {\n      options.project = getDefaultAngularAppName(workspace);\n    }\n    const project = workspace.projects.get(options.project);\n\n    if (!project || project.extensions.projectType !== 'application') {\n      throw new SchematicsException(`Ionic Add requires a project type of \"application\".`);\n    }\n    const sourcePath: Path = join(project.sourceRoot as Path);\n    const rootTemplateSource = apply(url('./files/root'), [template({ ...options }), move(sourcePath)]);\n    return chain([\n      // @ionic/angular\n      addIonicAngularToPackageJson(),\n      addIonicAngularToolkitToPackageJson(),\n      addIonicAngularToolkitToAngularJson(),\n      addIonicAngularModuleToAppModule(sourcePath),\n      addProvideIonicAngular(options.project, sourcePath),\n      addIonicBuilder(options.project),\n      addIonicStyles(options.project, sourcePath),\n      addIonicons(options.project, sourcePath),\n      addIonicConfig(sourcePath),\n      mergeWith(rootTemplateSource),\n      // install freshly added dependencies\n      installNodeDeps(),\n    ]);","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/ionic-team/ionic-framework/blob/625f9c38ad8c5db8a6c12df5c1622a36da90f9e3/packages/angular/src/schematics/add/index.ts#L193-L229","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the correct application project: `ng add @ionic/angular --project=my-app`.","If the workspace has no application project, create one first (`ng generate application my-app`) then re-run the schematic.","Verify angular.json lists a project with \"projectType\": \"application\" and use that name.","Ensure you run the schematic from the Angular workspace root with a valid angular.json."],"exampleFix":"// before\nng add @ionic/angular                // defaults to a library project\nng add @ionic/angular --project=shared-lib\n\n// after\nng add @ionic/angular --project=my-app   // where my-app is projectType 'application'","handlingStrategy":"validation","validationCode":"// Validate the project before running the schematic:\nfunction isApplicationProject(project?: { extensions?: { projectType?: string } }): boolean {\n  return !!project && project.extensions?.projectType === 'application';\n}\n// CLI: ng add @ionic/angular --project=<application-project-name>","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run Ionic Add against an application project, not a library.","Use --project to target the right workspace project.","Ensure angular.json has at least one 'application' project."],"tags":["angular","schematics","build-tooling","workspace","cli"],"backgroundTag":null,"analyzedSha":"625f9c38ad8c5db8a6c12df5c1622a36da90f9e3","analyzedAt":"2026-08-12T16:00:25.413Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}