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!

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

6 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.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • 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!

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Hello, Thank you for explaining the issue in detail. It may be related to a misconfigured installation. Could you add the following resolutions to your package.json and try reinstalling?

      "resolutions": {
        "@ng-bootstrap/ng-bootstrap": "~19.0.0",
        "@volo/abp.commercial.ng.ui": "~10.0.3",
        "@volo/abp.ng.account": "~10.0.3"
      },
    

    You can let us know if you need further assistance. Thank you for your cooperation.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    triet.nguyen created

    Hi,

    Thank you for your response. I followed your instruction and applied in both my real project & the public repository above.

    The problem is still persisting. Please verify on your end to make sure you have the same issue!

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Hello again,

    I apologize for overlooking the project in your original question. After reviewing the project you shared, I noticed that some paths in the tsconfig.json file redirect to node_modules. This approach is no longer supported. You can find more details here:

    https://abp.io/community/articles/angular-library-linking-made-easy-paths-workspaces-and-5z2ate6e#how-path-references-worked-before-the-new-angular-application-builder

    /* To learn more about this file see: https://angular.io/config/tsconfig. */
    {
      "compileOnSave": false,
      "compilerOptions": {
        // ...
        "paths": {
          "product-service": ["src/product-service/public-api.ts"]
          // "@abp/*": ["node_modules/@abp/*"],
          // "@volo/*": ["node_modules/@volo/*"]
        },
        "useDefineForClassFields": false
      },
    }
    
    

    I also noticed that some package versions are not aligned. In particular, the Angular-related packages and the TypeScript version should match specific compatible versions. Unless you have a specific reason to use different versions, I recommend aligning them as follows:

    {
      "name": "angular-starter",
      "private": true,
      "engines": {
        "node": "^22.0.0"
      },
      //...
      "resolutions": {
        "@ng-bootstrap/ng-bootstrap": "~19.0.0",
        "@volo/abp.commercial.ng.ui": "~10.0.3",
        "@volo/abp.ng.account": "~10.0.3"
      },
      "dependencies": {
        "@abp/ng.components": "~10.0.3",
        "@abp/ng.feature-management": "~10.0.3",
        "@abp/ng.core": "~10.0.3",
        "@abp/ng.oauth": "~10.0.3",
        "@abp/ng.setting-management": "~10.0.3",
        "@abp/ng.tenant-management": "~10.0.3",
        "@abp/ng.theme.shared": "~10.0.3",
        "@abp/ng.theme.lepton-x": "~5.0.3",
        "@angular/animations": "~20.0.0",
        "@angular/common": "~20.0.0",
        "@angular/compiler": "~20.0.0",
        "@angular/core": "~20.0.0",
        "@angular/forms": "~20.0.0",
        "@angular/localize": "~20.0.0",
        "@angular/platform-browser": "~20.0.0",
        "@angular/platform-browser-dynamic": "~20.0.0",
        "@angular/router": "~20.0.0",
        //...
        "@volo/abp.commercial.ng.ui": "~10.0.3",
        "@volo/abp.ng.account": "~10.0.3",
        "@volo/abp.ng.audit-logging": "~10.0.3",
        "@volo/abp.ng.chat": "~10.0.3",
        "@volo/abp.ng.file-management": "~10.0.3",
        "@volo/abp.ng.gdpr": "~10.0.3",
        "@volo/abp.ng.identity": "~10.0.3",
        "@volo/abp.ng.language-management": "~10.0.3",
        "@volo/abp.ng.openiddictpro": "~10.0.3",
        "@volo/abp.ng.saas": "~10.0.3",
        "@volo/abp.ng.text-template-management": "~10.0.3",
        "@volosoft/abp.ng.theme.lepton-x": "~5.0.3",
        //...
      },
      "devDependencies": {
        "@abp/ng.schematics": "~10.0.3",
        "@angular/build": "~20.0.0",
        "@angular-eslint/builder": "~20.0.0",
        "@angular-eslint/eslint-plugin": "~20.0.0",
        "@angular-eslint/eslint-plugin-template": "~20.0.0",
        "@angular-eslint/schematics": "~20.0.0",
        "@angular-eslint/template-parser": "~20.0.0",
        "@angular/cli": "~20.0.0",
        "@angular/compiler-cli": "~20.0.0",
        "@angular/language-service": "~20.0.0",
        "@types/file-saver": "^2.0.7",
        "@types/jasmine": "~3.6.0",
        "@types/jszip": "^3.4.0",
        "@types/node": "^20.17.16",
        "@typescript-eslint/eslint-plugin": "^8.50.0",
        "@typescript-eslint/parser": "^8.50.0",
        //...
        "typescript": "~5.8.0"
      }
    }
    
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    triet.nguyen created

    Hi,

    Thank you for your clarification! And it does solve the issue.

    I find the root cause from your answers by adding resolutions & upgrade theme.lepton-x related packages to ~5.0.3.

    And removing // "@abp/*": ["node_modules/@abp/*"], // "@volo/*": ["node_modules/@volo/*"] in tsconfig.json file

    // packages.json
    {
      // ...
      "resolutions": { 
        "@ng-bootstrap/ng-bootstrap": "~19.0.0",
        "@volo/abp.commercial.ng.ui": "~10.0.3",
        "@volo/abp.ng.account": "~10.0.3"
      },
      "dependencies": {
        // ...
        "@abp/ng.theme.lepton-x": "~5.0.3",
        // ...
        "@volosoft/abp.ng.theme.lepton-x": "~5.0.3"
      },
      "devDependencies": {
        // ...
      }
    }
    
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
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.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.