angular/angular-cli · error · Error

Proxy configuration file

Error message

Proxy configuration file ${proxyPath} does not exist.

What it means

When serving with a proxy, the dev-server webpack config resolves the `proxyConfig` option against the workspace root and verifies the file exists. This error is thrown when the configured proxy file path does not exist on disk. It fails fast instead of silently serving without proxying.

Solutions

  1. Create the proxy config file at the exact path given (e.g. `proxy.conf.json` at the workspace root).
  2. Fix the path in the command or angular.json `serve.options.proxyConfig` — remember it resolves relative to the workspace root.
  3. In monorepos, use a path relative to the workspace root like `projects/app/proxy.conf.json`.
  4. Verify the file exists with `ls <resolved-path>` from the directory where `ng serve` runs.

Example fix

// before (file missing)
ng serve --proxy-config ./src/proxy.config.json
// after (file exists at workspace root)
ng serve --proxy-config proxy.conf.json
Defensive patterns

Strategy: validation

Validate before calling

import * as fs from 'fs';
import * as path from 'path';
const proxyPath = path.resolve(workspaceRoot, 'proxy.conf.json');
if (!fs.existsSync(proxyPath)) {
  throw new Error(`Create proxy config at ${proxyPath} before running ng serve`);
}

Prevention

When it happens

Trigger: `ng serve --proxy-config <path>` (or `proxyConfig` in angular.json serve options) where `resolve(root, proxyConfig)` points to a non-existent file — wrong relative path, typo, or file never created.

Common situations: Running `ng serve --proxy-config proxy.conf.json` from a different working directory than expected; the file is named `proxy.conf.js` vs `.json`; path written relative to the project dir instead of workspace root (or vice versa in monorepos); fresh clone where the proxy file is gitignored.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/067221f2f1569ecd. Report an issue: GitHub.

Appendix: source

Thrown at packages/angular_devkit/build_angular/src/tools/webpack/configs/dev-server.ts:166

  };
}

/**
 * Private method to enhance a webpack config with Proxy configuration.
 * @private
 */
async function addProxyConfig(
  root: string,
  proxyConfig: string | undefined,
): Promise<object[] | undefined> {
  if (!proxyConfig) {
    return undefined;
  }

  const proxyPath = resolve(root, proxyConfig);

  if (!existsSync(proxyPath)) {
    throw new Error(`Proxy configuration file ${proxyPath} does not exist.`);
  }

  let proxyConfiguration;

  switch (extname(proxyPath)) {
    case '.json': {
      const content = await fsPromises.readFile(proxyPath, 'utf-8');

      const { parse, printParseErrorCode } = await import('jsonc-parser');
      const parseErrors: import('jsonc-parser').ParseError[] = [];
      proxyConfiguration = parse(content, parseErrors, { allowTrailingComma: true });

      if (parseErrors.length > 0) {
        let errorMessage = `Proxy configuration file ${proxyPath} contains parse errors:`;
        for (const parseError of parseErrors) {
          const { line, column } = getJsonErrorLineColumn(parseError.offset, content);
          errorMessage += `\n[${line}, ${column}] ${printParseErrorCode(parseError.error)}`;
        }

View on GitHub (pinned to bb72145f9a)