angular: R3InjectorError encountered after upgrading from Angular 19.1.4 to 19.2.6

Which @angular/* package(s) are the source of the bug?

upgrade

Is this a regression?

Yes

Description

Description: After upgrading my workspace from Angular 19.1.4 to 19.2.6, I am encountering several R3InjectorError errors in the console when the application is deployed. These errors appear only in a deployed environment.

Steps to Reproduce:

  • Upgrade the workspace from Angular 19.1.4 to 19.2.6.
  • Build the application using the production configuration.
  • Deploy the built application locally. (http-server)
  • Open the browser console and observe the R3InjectorError messages.

Additional Details: The issue does not occur during a standard development build. Reproducing the error requires using the production configuration. The errors are related to dependency injection, suggesting there might be a misconfiguration or a breaking change introduced in version 19.2.6. Any insights or recommendations on how to resolve this issue would be greatly appreciated.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

2716.73cbd997df6af897.js:1 ERROR NullInjectorError: R3InjectorError[au -> o -> o]: 
  NullInjectorError: No provider for o!
    at Ri.get (2716.73cbd997df6af897.js:1:32871)
    at an.get (2716.73cbd997df6af897.js:1:36343)
    at an.get (2716.73cbd997df6af897.js:1:36343)
    at gw (2716.73cbd997df6af897.js:1:31099)
    at Ie (2716.73cbd997df6af897.js:1:31177)
    at Ba (2716.73cbd997df6af897.js:1:31646)
    at Object.r [as factory] (2716.73cbd997df6af897.js:1:38808)
    at an.hydrate (2716.73cbd997df6af897.js:1:37832)
    at an.get (2716.73cbd997df6af897.js:1:36296)
    at e.synchronize (2716.73cbd997df6af897.js:1:166836)

THEN optimization=false:

7705.de4db2f7e67e939d.js:7087 ERROR NullInjectorError: R3InjectorError(Environment Injector)[RendererFactory2 -> DomRendererFactory2 -> DomRendererFactory2]: 
  NullInjectorError: No provider for DomRendererFactory2!
    at NullInjector.get (7705.de4db2f7e67e939d.js:2161:21)
    at R3Injector.get (7705.de4db2f7e67e939d.js:2689:27)
    at R3Injector.get (7705.de4db2f7e67e939d.js:2689:27)
    at injectInjectorOnly (7705.de4db2f7e67e939d.js:1667:28)
    at ɵɵinject (7705.de4db2f7e67e939d.js:1673:59)
    at injectArgs (7705.de4db2f7e67e939d.js:1798:17)
    at Object.factory (7705.de4db2f7e67e939d.js:2897:46)
    at 7705.de4db2f7e67e939d.js:2802:35
    at runInInjectorProfilerContext (7705.de4db2f7e67e939d.js:1438:5)
    at R3Injector.hydrate (7705.de4db2f7e67e939d.js:2801:11)
handleError	@

Please provide the environment you discovered this bug in (run ng version)

"@angular/animations": "19.2.6",
    "@angular/common": "19.2.6",
    "@angular/compiler": "19.2.6",
    "@angular/core": "19.2.6",
    "@angular/forms": "19.2.6",
    "@angular/platform-browser": "19.2.6",
    "@angular/platform-browser-dynamic": "19.2.6",
    "@angular/router": "19.2.6",
    "@nx/angular": "20.1.4",
    "typescript": "5.7.3",

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

I have the same issue also running microfrontends. The platform-browser is federated. I can pinpoint the issue to arise from 19.2.4 -> 19.2.5, however there is nothing in the release notes regarding this package

NullInjectorError: R3InjectorError[RendererFactory2 -> RendererFactory2 -> DomRendererFactory2 -> DomRendererFactory2]: 
  NullInjectorError: No provider for DomRendererFactory2!


RuntimeError: NG0200: Circular dependency in DI detected for RendererFactory2. Find more at https://angular.dev/errors/NG0200

Since we didn’t observe this issue in Google’s code base, we strongly believe that there is something happening specifically in your project.

Without a repro this is hardly actionable on our side.