Open Closed

No provider found for `InjectionToken SORT_COMPARE_FUNC`, `InjectionToken CORE_OPTIONS, and Circular dependency detected for `_ConfigStateService` #10505


User avatar
0
triet.nguyen created

Hi,

Steps to reproduce the issue:

  • I've migrated ABP backend from v9.3.2 -> v10.0.3 done.
  • I continue migrating ABP Angular app v9.3.2 -> v10.0.3.
  • Fix issues of warnings/errors in codebase (our components).
  • First issue, I get as below:
// root_effect_scheduler.mjs:3637
❌ ERROR RuntimeError: NG0200: Circular dependency detected for `_ConfigStateService`. Find more at https://v20.angular.dev/errors/NG0200

// main.ts:29 
❌ RuntimeError: NG0200: Circular dependency detected for `_ConfigStateService`. Find more at https://v20.angular.dev/errors/NG0200

// root_effect_scheduler.mjs:3637
❌ ERROR ɵNotFound: NG0201: No provider found for `InjectionToken CORE_OPTIONS`. Find more at https://v20.angular.dev/errors/NG0201
  • Next, I search the problem and I notice to add this "@abp/*": ["node_modules/@abp/*"], "@volo/*": ["node_modules/@volo/*"] into tsconfig.json. In fact, it solves the problem.
  • Then, I get other issues as below

Exception message and full stack trace:

//root_effect_scheduler.mjs:3637
❌ ERROR ɵNotFound: NG0201: No provider found for `InjectionToken SORT_COMPARE_FUNC`. Find more at https://v20.angular.dev/errors/NG0201
    at createRuntimeError (root_effect_scheduler.mjs:924:19)
    at NullInjector.get (root_effect_scheduler.mjs:1494:27)
    at R3Injector.get (root_effect_scheduler.mjs:2052:33)
    at R3Injector.get (root_effect_scheduler.mjs:2052:33)
    at R3Injector.retrieve (root_effect_scheduler.mjs:1936:25)
    at injectInjectorOnly (root_effect_scheduler.mjs:1049:39)
    at ɵɵinject (root_effect_scheduler.mjs:1061:42)
    at inject2 (root_effect_scheduler.mjs:1149:12)
    at new AbstractMenuService (abp-ng.theme.shared.mjs:1701:19)
    at new _UserMenuService (abp-ng.theme.shared.mjs:2138:5)

// main.ts:22
❌ ɵNotFound: NG0201: No provider found for `InjectionToken SORT_COMPARE_FUNC`. Find more at https://v20.angular.dev/errors/NG0201
    at createRuntimeError (root_effect_scheduler.mjs:924:19)
    at NullInjector.get (root_effect_scheduler.mjs:1494:27)
    at R3Injector.get (root_effect_scheduler.mjs:2052:33)
    at R3Injector.get (root_effect_scheduler.mjs:2052:33)
    at R3Injector.retrieve (root_effect_scheduler.mjs:1936:25)
    at injectInjectorOnly (root_effect_scheduler.mjs:1049:39)
    at ɵɵinject (root_effect_scheduler.mjs:1061:42)
    at inject2 (root_effect_scheduler.mjs:1149:12)
    at new AbstractMenuService (abp-ng.theme.shared.mjs:1701:19)
    at new _UserMenuService (abp-ng.theme.shared.mjs:2138:5)

// abp-ng.core.mjs:159
❌ You should add @abp/ng-oauth packages or create your own auth packages.

Here is the public repository you can pull and verify: https://github.com/trietng-decisiontreetech/abp_angular_upgrade_10.0.3 Please let me know if you find something. Thank you in advance!


2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • Undo the tsconfig.json path mappings to node_modules (the ones like @abp/*: node_modules/@abp/*, @volo/*: node_modules/@volo/*).
      Those mappings can make Angular/TS resolve different physical copies / entry points of the same ABP packages and that commonly ends up as:

      • duplicated DI tokens (so you get “No provider found for InjectionToken …” even though you “provided” it),
      • and circular DI graphs (like _ConfigStateService).
    • Fix the SORT_COMPARE_FUNC error by registering its provider (only if you really need custom sorting).
      If your app uses ABP menu/navigation sorting customization, you must provide the token:

    // app.module.ts (or a core module that is imported once)
      import { NgModule } from '@angular/core';
      import { SORT_COMPARE_FUNC } from '@abp/ng.core';
    
      export function sortCompareFuncFactory() {
        return (a: any, b: any) => 0; // replace with your compare logic
      }
    
      @NgModule({
        providers: [
          {
            provide: SORT_COMPARE_FUNC,
            useFactory: sortCompareFuncFactory,
          },
        ],
      })
      export class AppModule {}
    

    If you don’t need custom sorting, the real fix is still the first bullet (stop forcing @abp/* / @volo/* to resolve from node_modules via paths), because ABP’s own module should normally provide the default token.

    • Fix the “You should add @abp/ng-oauth packages…” message by installing/including ABP’s Angular auth package (for v10 this is still the @abp/ng.oauth package family). Ensure it’s referenced in package.json and that your app is bootstrapped with the ABP auth module/provider setup (otherwise you’ll get missing CORE_OPTIONS / auth-related tokens as well).
      (This error is emitted by ABP when no auth package is present/loaded.)

    • Then clean-install dependencies to remove any duplicated dependency tree:

      1. delete node_modules and lock file (package-lock.json or yarn.lock)
      2. reinstall (npm ci or yarn install)
      3. run again

    • https://abp.io/docs/10.0/release-info/migration-guides/abp-10-0
    • https://abp.io/docs/latest/framework/ui/angular/sorting-navigation-elements

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    triet.nguyen created

    Hi,

    I need a person to support me this case. None of the responses from ABP Agent work for me!

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.3.0-preview. Updated on March 09, 2026, 08:51
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.