angular/angular-cli · error · Error
Proxy configuration file ${proxyPath} does not exist.
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.
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)
Solutions
- Create the proxy config file at the exact path given (e.g. `proxy.conf.json` at the workspace root).
- Fix the path in the command or angular.json `serve.options.proxyConfig` — remember it resolves relative to the workspace root.
- In monorepos, use a path relative to the workspace root like `projects/app/proxy.conf.json`.
- 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
- Commit proxy.conf.json to the repo (don't gitignore it).
- Remember proxyConfig resolves relative to the workspace root, not the project dir.
- Keep the CLI flag path and the angular.json option path in sync.
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.
Related errors
- Webpack Dev Server configuration was not set.
- Proxy configuration file ${proxyPath} contains parse errors:
- Warning: --deploy-url and/or --base-href contain unsupported
- No project name provided and no default project found in wor
- Option "project" is required.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/067221f2f1569ecd.
Report an issue: GitHub.