Angular errors

Angular errors (NG0100, NullInjectorError, NG8002…) — change detection, dependency injection and templates.

CodeErrorWhat it means
Node.js version detected. The Angular CLI requires a minimum Angular CLI: Node.js version v16.20.2 detected. The Angular CLI requires a minimum Node.js version of v18.19.1 Your Node.js is older (or newer, unsupported) than the Angular CLI version needs.
NullInjectorError Angular: NullInjectorError: No provider for X! Angular’s dependency injection couldn’t find a provider for a service/token the component needs.
Could not find the builder's node package Angular CLI: Could not find the '@angular-devkit/build-angular:browser' builder's node package / Cannot find module '@angular-devkit/build-angular/package.json' The build tooling package is missing from `node_modules` — dependencies were not installed or the lockfile/in…
NG8002 Angular: NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input' The template uses a property binding that no imported directive provides — for ngModel, FormsModule isn’t imp…
mat-form-field must contain a MatFormFieldControl Angular Material: Error: mat-form-field must contain a MatFormFieldControl A `` has no Material input inside, or the module that provides `matInput`/`mat-select` is not imported.
Karma Disconnected / no captured browser Angular tests: Disconnected, because no message in 30000 ms. / ERROR [launcher]: Cannot start ChromeHeadless `ng test` could not start or keep the browser Karma uses — Chrome is missing, runs as root in a container, or…
NG02100 Angular: NG02100: InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe' The `async` pipe received a plain object or array instead of an Observable or Promise.
proxy.conf.json not working Angular CLI: [HPM] Error occurred while proxying request localhost:4200 to http://localhost:3000 [ECONNREFUSED] The `ng serve` dev proxy cannot forward your API call — it was not enabled, the path does not match, or the t…
Cannot find control with name Angular: Error: Cannot find control with name: 'email' (reactive forms) A `formControlName` points at a control that does not exist in the bound `FormGroup`.
Repository is not clean Angular CLI: Repository is not clean. Please commit or stash any changes before updating. `ng update` refuses to run because git has uncommitted changes; it wants every migration to be a reviewable d…
NG0100 Angular: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked A template value changed during the same change-detection cycle in which Angular already checked it (dev-mode…
Schema validation failed with the following errors Angular CLI: Schema validation failed with the following errors: Data path "" must NOT have additional properties(xyz) `angular.json` (or an option you passed to a builder) contains a property the schema does not allow — a typo,…
Http failure response for (unknown url): 0 Unknown Error Angular: HttpErrorResponse — Http failure response for (unknown url): 0 Unknown Error (status 0) `HttpClient` got no HTTP response at all: the request was blocked (CORS), failed at network level, or the ser…
NG0200 Angular: NG0200: Circular dependency in DI detected for X Two or more services inject each other (directly or through a chain), so Angular cannot create any of them fi…
NG04014 Angular: NG04014: Invalid configuration of route 'x': one of the following must be provided: component, loadComponent, redirectTo, children or loadChildren A route object has a path but nothing for the router to render or load.
Can't find stylesheet to import Angular (Sass): Error: Can't find stylesheet to import. @import 'variables'; A Sass `@import` / `@use` cannot resolve its path — wrong relative path, missing underscore partial, or the i…
ng: command not found Angular CLI: zsh: command not found: ng / 'ng' is not recognized as an internal or external command The Angular CLI is not installed globally or its folder is not on your PATH.
NG01203 Angular: NG01203: No value accessor for form control with name: 'x' (ControlValueAccessor missing) A form directive (`formControlName`, `ngModel`) is on an element or component that Angular cannot read/write…
NG0950 Angular: NG0950: Input is required but no value is available yet (input.required / viewChild.required) A required signal input or query was read before Angular set it — in the constructor or too early in the life…
NG8001 Angular: NG8001: 'app-item' is not a known element — verify that it is included in the component's imports The template uses a tag Angular does not recognise as a component — it was never imported (standalone) or dec…
NG8003 Angular: NG8003: No directive found with exportAs 'ngForm' (template reference variable) A template reference such as `#f="ngForm"` points at a directive Angular cannot find on that element — the mo…
Expected to be running in 'ProxyZone' Angular tests: Error: Expected to be running in 'ProxyZone', but it was not found. `fakeAsync` / `waitForAsync` was used, but the test environment's zone testing setup is missing.
The Angular Compiler requires TypeScript Angular: Error: The Angular Compiler requires TypeScript >=5.4.0 and <5.6.0 but 5.7.2 was found instead The installed TypeScript version is outside the range your Angular version supports.
NG01050 Angular: NG01050: formControlName must be used with a parent formGroup directive `formControlName` is used outside any `[formGroup]` — the control has no form to belong to.
NG01352 Angular: NG01352: If ngModel is used within a form tag, either the name attribute must be set or the form control must be defined as 'standalone' An `[(ngModel)]` input sits inside a `` but has no `name`, so Angular cannot register it as a form control.
NG0201 Angular: NG0201: No provider for X found in NodeInjector A component or directive asked for a service no injector in its tree provides.
NG0203 Angular: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer or a function used with runInInjectionContext `inject()` was called somewhere Angular is not constructing a class — for example inside a method, a callback…
NG0300 Angular: NG0300: Multiple components match node with tagname app-x: A and B Two components in scope share the same selector, so Angular cannot decide which one renders for that tag.
NG0301 Angular: NG0301: Export of name 'x' not found! (template variable #x="exportAs") A template variable asks for a directive by `exportAs` name, but no directive with that export is on the elem…
NG04002 Angular: NG04002: Cannot match any routes. URL Segment: 'x' The router found no route for the URL you navigated to — missing route, wrong path, or an unloaded lazy route.
NG0912 Angular: NG0912: Component ID generation collision detected. Components 'A' and 'B' with selector 'app-x' use the same ID Angular generated the same internal id for two different components — usually two components with the same se…
NG6008 Angular: NG6008: Component X is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? A standalone component, directive or pipe was listed in an NgModule's `declarations` array.
EmptyError RxJS: EmptyError: no elements in sequence (firstValueFrom / lastValueFrom on an empty Observable) `firstValueFrom`, `lastValueFrom`, `first()` or `last()` waited for a value but the Observable completed with…
You provided 'undefined' where a stream was expected RxJS: TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable. An RxJS operator (`switchMap`, `mergeMap`, `forkJoin`, `subscribe`) received `undefined` — a function forgot…
Cannot GET /route on refresh Angular (production): Cannot GET /dashboard — 404 when refreshing or opening a deep link The web server only knows `index.html`; a direct request to `/dashboard` is not a file, so it returns 404 ins…
exceeded maximum budget Angular build: Error: bundle initial exceeded maximum budget. Budget 1.00 MB was not met by 120.00 kB with a total of 1.12 MB The production build is larger than the size limits (budgets) in angular.json, and the build is configured to…
window is not defined Angular SSR: ReferenceError: window is not defined / document is not defined / localStorage is not defined Code that only works in a browser ran during server-side rendering, where `window`, `document` and `localStor…
Http failure during parsing Angular: Http failure during parsing for http://…: SyntaxError: Unexpected token '<' (response is not JSON) The request succeeded (status 200) but the body could not be parsed as the expected type — usually HTML or pl…
NG02200 Angular: NG02200: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays `*ngFor` (or `@for`) was given an object, `null` shape or a non-iterable instead of an array.
NG0600 Angular: NG0600: Writing to signals is not allowed in a computed or an effect by default A `computed()` (or, by default, an `effect()`) tried to call `.set()` or `.update()` on a signal — that creat…
ERESOLVE peer dependency conflict after ng update Angular: npm ERR! ERESOLVE could not resolve — Conflicting peer dependency: @angular/core@"^16.0.0" (after ng update / ng add) A package in your project requires an older Angular version than the one you are installing, so npm refuses t…
NullInjectorError: No provider for ActivatedRoute! Angular: NullInjectorError: No provider for ActivatedRoute! (also Router) — usually a unit test A component injects `ActivatedRoute` or `Router`, but no router providers exist in the injector — typical in…
NullInjectorError: No provider for HttpClient! Angular: NullInjectorError: No provider for HttpClient! — provideHttpClient() missing A service or component injects `HttpClient`, but HTTP support was never added to the app's providers.
ViewChild is undefined Angular: TypeError: Cannot read properties of undefined (reading 'nativeElement') — @ViewChild used in ngOnInit A `@ViewChild` / `viewChild()` reference is `undefined` because the view is not created yet, or the element s…
Port 4200 is already in use Angular CLI: Port 4200 is already in use. Use '--port' to specify a different port Another process is already listening on the dev-server port, often an earlier `ng serve` that was not stopped.
Component is not resolved: templateUrl Angular tests: Component 'X' is not resolved: templateUrl: ./x.component.html — Did you run and wait for 'resolveComponentResources()'? A test created a component whose external template was not compiled yet — `compileComponents()` was not calle…
Http failure response: 404 Not Found Angular: Http failure response for http://…/api/x: 404 Not Found (HttpErrorResponse) The API answered 404 — the URL is wrong (base URL, path or id), or the proxy/rewrite does not forward the req…
NG0955 Angular: NG0955: The provided track expression resulted in duplicated keys for a given collection (@for) In an `@for` block (or `trackBy`), two items produced the same tracking key, so Angular cannot match them to…
NG8004 Angular: NG8004: No pipe found with name 'async' / 'date' / 'translate' — pipe not imported The template uses a pipe Angular does not know — it is not imported into the component (standalone) or its mo…
NG8103 Angular: NG8103: The *ngIf directive was used, but neither the NgIf directive nor the CommonModule was imported A standalone component uses `*ngIf`, `*ngFor` or `ngClass` without importing the directive — or should migrat…
NG8113 Angular: NG8113: NgIf is not used within the template of AppComponent — unused standalone import A standalone component lists a directive, pipe or component in `imports` but never uses it in its template.
NG02100 Angular: NG02100: InvalidPipeArgument: 'Unable to convert "x" into a date' for pipe 'DatePipe' The `date` pipe was given a value it cannot turn into a Date — an invalid string, a non-ISO format, `null` ha…
NG0500 Angular SSR: NG0500: During hydration Angular expected <div> but found <span> (NG0501, NG0502) The HTML rendered on the server does not match what the browser's Angular app tried to render, so hydration f…