Open Closed

Bug: Modules created with ABP Studio have badly integrated node_module dependencies #10734


User avatar
0
PDarioJer created

As the title suggests, when you a modular Application with an initial module and install it, you get type errors. The integration model that the generator uses seems to be itself broken. I've fixed it temporarily by adding a manual symlink in the symlink-config.ps1 file but I don't know how stable that will be.

  • Exception message and full stack trace: Type 'import("C:/Users/user/source/repos/App/modules/examplemodule/angular/node_modules/@angular/router/router_module.d").Routes' is not assignable to type 'import("C:/Users/user/source/repos/App/angular/node_modules/@angular/router/types/_router_module-chunk").Routes'.
  • Steps to reproduce the issue:
  • Install ABP Studio
  • Create a new solution in Classic mode
  • On modularity, set up as modular solution and create an example module
  • Once it's installed, import the module as per the documentation https://abp.io/docs/latest/tutorials/modular-crm/part-02?UI=NG
  • Try to run the angular application
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • This error happens because your module’s Angular library project (e.g. modules/examplemodule/angular/...) ends up compiling against a different physical copy of Angular packages than the main app (App/angular/...). So TypeScript sees two different Routes types:

      • .../modules/examplemodule/angular/node_modules/@angular/router/...
      • .../angular/node_modules/@angular/router/... and they are incompatible even if versions look identical.
    • Definitive fix (recommended approach): ensure module UI projects use the main app’s node_modules via symlinks (single dependency graph).

      1. Keep the module source referenced via tsconfig paths (as ABP modular UI does), but do not allow the module project to have its own independent node_modules resolution.
      2. Use the ABP symlink scripts to link dependencies from App/angular/node_modules into each module’s angular/projects/... (or the module’s angular workspace) so everything resolves to one place.
      3. In practice, this means your symlink-config.ps1 should include at least these packages to be shared from the main app to the module libs:
        • @angular/*
        • rxjs
        • tslib
        • @abp/* / @volo/* (if used inside the module UI lib)

      This is exactly aligned with the behavior you observed: manually symlinking fixes it because it forces a single Angular dependency instance.

    • Stable alternative (also works, but slower for dev): build & consume the module UI as a package instead of paths

      • Build the module’s Angular library and reference it as a file: dependency from the main Angular app, avoiding tsconfig.paths pointing to library sources. This also prevents duplicate node_modules graphs.

    Sources:

    • https://abp.io/community/articles/5z2ate6e
    • https://abp.io/docs/latest/framework/ui/angular/quick-start
    • https://abp.io/docs/latest/tutorials/modular-crm/part-02?UI=NG

    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
    maliming created
    Support Team Fullstack Developer

    Hi,

    Your workaround is the right one — editing symlink-config.ps1 and re-running the symlink script is the supported mechanism, so it will hold up across rebuilds.

    Edit <your-app>/angular/scripts/symlink-config.ps1 and list each imported module:

    $script:PackageDirectories = @(
        "../../modules/<your-module-name>/angular"
    )
    

    (One line per module.)

    Then from <your-app>/angular/scripts/, run:

    pwsh ./setup-symlinks.ps1
    

    You should see Linked @angular, Linked rxjs, Linked tslib printed, and the Routes mismatch will be gone. The default $PackagesToSymlink array already covers all the standard packages, so you only need to add the directory path.

    We'll fix this on our side so the entry gets added and the symlinks get refreshed automatically when you Import a module. It'll go out in the next ABP Studio release.

    Thanks

    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 21, 2026, 06:18
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.