{"record":{"id":"bc708e43580ced78","repo":"angular/angular-cli","slug":"project-name-options-project-doesn-t-not-exis-bc708e","errorCode":null,"errorMessage":"Project name \"${options.project}\" doesn't not exist.","messagePattern":"Project name \"(.+?)\" doesn't not exist\\.","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/schematics/angular/environments/index.ts","lineNumber":22,"sourceCode":" *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport { Rule, SchematicsException, chain } from '@angular-devkit/schematics';\nimport { posix as path } from 'node:path';\nimport { TargetDefinition, updateWorkspace } from '../utility/workspace';\nimport { Builders as AngularBuilder } from '../utility/workspace-models';\nimport { Schema as EnvironmentOptions } from './schema';\n\nconst ENVIRONMENTS_DIRECTORY = 'environments';\nconst ENVIRONMENT_FILE_CONTENT = 'export const environment = {};\\n';\n\nexport default function (options: EnvironmentOptions): Rule {\n  return updateWorkspace((workspace) => {\n    const project = workspace.projects.get(options.project);\n    if (!project) {\n      throw new SchematicsException(`Project name \"${options.project}\" doesn't not exist.`);\n    }\n\n    const type = project.extensions['projectType'];\n    if (type !== 'application') {\n      return log(\n        'error',\n        'Only application project types are support by this schematic.' + type\n          ? ` Project \"${options.project}\" has a \"projectType\" of \"${type}\".`\n          : ` Project \"${options.project}\" has no \"projectType\" defined.`,\n      );\n    }\n\n    const buildTarget = project.targets.get('build');\n    if (!buildTarget) {\n      return log(\n        'error',\n        `No \"build\" target found for project \"${options.project}\".` +\n          ' A \"build\" target is required to generate environment files.',","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/schematics/angular/environments/index.ts#L4-L40","documentation":"The `environments` schematic resolves `options.project` in the workspace and throws this SchematicsException when the name does not match any project in angular.json. Like the config schematic, it refuses to proceed for unknown projects since it must locate the project's source root to generate `environment.ts`/`environment.development.ts` files.","triggerScenarios":"Running `ng generate environments --project <name>` where `<name>` is not an exact key in the workspace `projects` map — typos, wrong casing, npm package names, or a project removed/renamed in angular.json.","commonSituations":"Multi-project (Nx-style or Angular workspace) users passing the wrong project; scripts referencing old project names after restructure; running the schematic outside the workspace root so the wrong angular.json is loaded.","solutions":["Open angular.json and pass the exact project key: `ng g environments --project <exact-name>`.","Run the command from the workspace root so the correct angular.json is read.","If the project was renamed, update scripts or restore the original project entry."],"exampleFix":"// before\nng g environments --project front-end-app   // registered as \"frontend-app\"\n// after\nng g environments --project frontend-app","handlingStrategy":"validation","validationCode":"const angularJson = JSON.parse(tree.read('angular.json')!.toString('utf8'));\nif (!angularJson.projects?.[options.project]) {\n  throw new Error(`Project \"${options.project}\" does not exist in this workspace`);\n}","typeGuard":"function hasProject(name: string, w: { projects: Record<string, unknown> }): boolean {\n  return !!w.projects[name];\n}","tryCatchPattern":"try {\n  await runSchematic('environments', { project });\n} catch (e) {\n  if (e instanceof SchematicsException && e.message.includes('doesn\\'t not exist')) {\n    console.error(`No project \"${project}\" — list keys under \"projects\" in angular.json.`);\n  } else throw e;\n}","preventionTips":["Pass `--project` with the exact angular.json key when in a multi-project workspace.","Execute the schematic from the workspace root so the right config is loaded.","Keep project names consistent between CI scripts and angular.json."],"tags":["angular","schematics","angular-json","environments","project-not-found"],"backgroundTag":"project-not-found-in-workspace","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}