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)

<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

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09