angular/angular-cli · error · SchematicsException
PWA requires a project type of "application".
Error message
PWA requires a project type of "application".
What it means
The PWA schematic only supports application-type projects. After locating the project, it checks project.extensions['projectType'] and throws if it is not 'application' (e.g. a library project).
Source
Thrown at packages/angular/pwa/pwa/index.ts:83
export default function (options: PwaOptions): Rule {
return async (host) => {
if (!options.title) {
options.title = options.project;
}
const workspace = await readWorkspace(host);
if (!options.project) {
throw new SchematicsException('Option "project" is required.');
}
const project = workspace.projects.get(options.project);
if (!project) {
throw new SchematicsException(`Project is not defined in this workspace.`);
}
if (project.extensions['projectType'] !== 'application') {
throw new SchematicsException(`PWA requires a project type of "application".`);
}
// Find all the relevant targets for the project
if (project.targets.size === 0) {
throw new SchematicsException(`Targets are not defined for this project.`);
}
const buildTargets = [];
const testTargets = [];
for (const target of project.targets.values()) {
if (
target.builder === '@angular-devkit/build-angular:browser' ||
target.builder === '@angular-devkit/build-angular:application' ||
target.builder === '@angular/build:application'
) {
buildTargets.push(target);
} else if (
target.builder === '@angular-devkit/build-angular:karma' ||View on GitHub (pinned to bb72145f9a)
Solutions
- Target the application project instead: ng add @angular/pwa --project my-app
- If the wrong projectType was set, fix angular.json: set extensions.projectType to 'application' for that project
- Create a new application project and apply PWA to it rather than the library
Example fix
// before (angular.json)
"my-lib": { "projectType": "library", ... }
// after (use the app project instead)
ng add @angular/pwa --project my-app Defensive patterns
Strategy: validation
Validate before calling
const p = angularJson.projects[name];
if (p?.extensions?.projectType !== 'application') {
throw new Error(`${name} is not an application project`);
} Type guard
function isApplicationProject(p: { extensions?: { projectType?: string } } | undefined): boolean {
return p?.extensions?.projectType === 'application';
} Try / catch
try {
await runPwaSchematic(projectName);
} catch (e) {
if (String(e.message).includes('project type of "application"')) {
console.error(`${projectName} is a library; target the application project instead`);
}
} Prevention
- Only apply the PWA schematic to projects with projectType 'application'
- In monorepos, keep a mapping of app vs lib projects in your scripts
- Check angular.json extensions before targeting a project programmatically
When it happens
Trigger: Running ng add @angular/pwa --project <name> where <name> is a library (projectType: 'library') in angular.json.
Common situations: Targeting an ng generate library project, monorepo setups where the chosen project is a shared lib instead of the app.
Related errors
- No "production" configuration found for build target. The "s
- No project name provided and no default project found in wor
- Option "project" is required.
- Project is not defined in this workspace.
- Targets are not defined for this project.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/7ece1b816cd2f0d5.
Report an issue: GitHub.