Open Closed

NullInjectorError when access to Permission features #773


User avatar
0
huy.quan created
  • ABP Framework version: v4.0.0

  • UI type: Angular

  • DB provider: EF Core

  • Identity Server Seperated (Angular): yes

  • Exception message and stack trace:
    ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(IdentityModule)[NgxsFeatureModule -> PermissionManagementState -> PermissionsService -> PermissionsService -> PermissionsService -> RestService -> InjectionToken CORE_OPTIONS -> InjectionToken CORE_OPTIONS -> InjectionToken CORE_OPTIONS]:

NullInjectorError: No provider for InjectionToken CORE_OPTIONS!
NullInjectorError: R3InjectorError(IdentityModule)[NgxsFeatureModule -> PermissionManagementState -> PermissionsService -> PermissionsService -> PermissionsService -> RestService -> InjectionToken CORE_OPTIONS -> InjectionToken CORE_OPTIONS -> InjectionToken CORE_OPTIONS]:
NullInjectorError: No provider for InjectionToken CORE_OPTIONS!
at NullInjector.get (core.js:10789)
at R3Injector.get (core.js:10956)
at R3Injector.get (core.js:10956)
at R3Injector.get (core.js:10956)
at injectInjectorOnly (core.js:4902)
at ɵɵinject (core.js:4906)
at Object.RestService_Factory [as factory] (abp-ng.core.js:322)
at R3Injector.hydrate (core.js:11124)
at R3Injector.get (core.js:10945)
at injectInjectorOnly (core.js:4902)
at resolvePromise (zone-evergreen.js:798)
at resolvePromise (zone-evergreen.js:750)
at zone-evergreen.js:860
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:28255)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)
at Zone.runTask (zone-evergreen.js:167)
at drainMicroTaskQueue (zone-evergreen.js:569)

image.png
<br>

  • Steps to reproduce the issue:

When I try to access any feature relate to Permission such as: Administrator -> Indentity Management -> Users or Roles -> Permission. It always show error and cannot open modal to edit Permission

Please let me know how to check or fix it

Thanks support team.


2 Answer(s)
  • User Avatar
    0
    Mehmet created

    Hi,

    There is no problem in v4.0.0 default template. Please check the imports in AppModule. CoreModule must be imported like this:

    //app.module.ts
    import { registerLocale } from '@abp/ng.core/locale';
    import { environment } from '../environments/environment';
    //...
    
        CoreModule.forRoot({
          environment,
          registerLocaleFn: registerLocale(),
        }),
    

    If the problem does not resolve, please share the app.module.ts content with us.

  • User Avatar
    0
    huy.quan created

    The imports above is correct now. Anw, I've just fixed it by removing folder node_modules and run script npm install to install all packages again. Everything is okay now.

    Thanks you, Mehmet

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08