{"record":{"id":"8bf76ce22361402c","repo":"angular/angular-cli","slug":"confguration-file-cannot-be-found","errorCode":null,"errorMessage":"Confguration file cannot be found.","messagePattern":"Confguration file cannot be found\\.","errorType":"exception","errorClass":"CommandModuleError","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/config/cli.ts","lineNumber":104,"sourceCode":"    } else if (typeof value === 'string') {\n      logger.info(value);\n    } else {\n      logger.info(JSON.stringify(value, null, 2));\n    }\n\n    return 0;\n  }\n\n  private async set(options: Options<ConfigCommandArgs>): Promise<number | void> {\n    if (!options.jsonPath?.trim()) {\n      throw new CommandModuleError('Invalid Path.');\n    }\n\n    const [config, configPath] = await getWorkspaceRaw(options.global ? 'global' : 'local');\n    const { logger } = this.context;\n\n    if (!config || !configPath) {\n      throw new CommandModuleError('Confguration file cannot be found.');\n    }\n\n    const normalizeUUIDValue = (v: string | undefined) => (v === '' ? randomUUID() : `${v}`);\n\n    const value =\n      options.jsonPath === 'cli.analyticsSharing.uuid'\n        ? normalizeUUIDValue(options.value)\n        : options.value;\n\n    const modified = config.modify(parseJsonPath(options.jsonPath), normalizeValue(value));\n\n    if (!modified) {\n      logger.error('Value cannot be found.');\n\n      return 1;\n    }\n\n    await validateWorkspace(parseJson(config.content), options.global ?? false);","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/config/cli.ts#L86-L122","documentation":"After resolving the raw workspace config via getWorkspaceRaw (local angular.json or the global .angular-config), set() throws if either the config or its path is missing. This means no configuration file exists in which the requested JSON-path change can be written.","triggerScenarios":"Running `ng config <path> <value>` in a directory with no angular.json (and --global not passed), or passing --global when no global .angular-config file exists / cannot be located.","commonSituations":"Executing the command outside an Angular project root; angular.json deleted or renamed; expecting `--global` to create a fresh global config file that isn't present; running in a CI workspace that never had angular.json generated.","solutions":["Run the command inside the Angular project directory containing angular.json","If you intend the global config, verify it exists (~/.angular-config or the value of NG_CLI_ANALYTICS/global config location) before using --global","Regenerate the workspace file (e.g. restore from VCS or `ng new`/`ng generate config` if applicable)","Set the global configuration explicitly via NG_CONFIG or create the file with an empty {} JSON object before editing"],"exampleFix":"// before (outside project)\nng config cli.defaultCollection my-lib\n// after\ncd my-angular-project && ng config cli.defaultCollection my-lib","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nconst globalMode = options.global;\nconst configFile = globalMode ? (process.env.NG_CONFIG ?? `${homedir()}/.angular-config`) : 'angular.json';\nif (!existsSync(configFile)) {\n  throw new Error(`Configuration file not found: ${configFile}. Run from an Angular project or create the global config.`);\n}","typeGuard":"function hasRawWorkspace(w: { config: unknown; path: string } | undefined | null)\n  : w is { config: unknown; path: string } {\n  return !!w && typeof w.path === 'string' && w.config != null;\n}","tryCatchPattern":"try {\n  await configCommand.run(options);\n} catch (e) {\n  if (e instanceof CommandModuleError && e.message.includes('Confguration file cannot be found')) {\n    logger.error('No angular.json (or global config) found — run inside an Angular project.');\n  } else { throw e; }\n}","preventionTips":["cd to the project root before running ng config","Keep angular.json committed to VCS","Only use --global when the global .angular-config file exists","In CI, generate the workspace before attempting config edits"],"tags":["angular-cli","config","workspace","file-not-found"],"backgroundTag":"config-file-not-found","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}