Open Closed

Issue with Dependency Injection Error After Upgrading to ABP 8.3.2 #8163


User avatar
0
mert.kir created
  • ABP Framework version: v8.3.2
  • UI Type: Angular
  • Database System: EF Core (SQL Server, PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:

After upgrading from ABP 8.2.3 to 8.3.2, I encountered a runtime error related to dependency injection. The error appears when launching the application and states:

RuntimeError: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`.
The error seems to originate from services like ToasterService and LinkLoginHandler. Prior to the upgrade, the application was working without this issue. I've attached a screenshot of the console output for reference.

Steps to Reproduce:

  1. Upgrade from ABP 8.2.3 to 8.3.2.
  2. Start the Angular application.
  3. Observe the console logs for the injection-related errors.

Expected Behavior: The application should run without dependency injection errors after the upgrade.

Actual Behavior: The application fails to properly inject services, leading to runtime errors and a disrupted user experience.

Note: We are using the Lepton theme in our Angular project Also, could you provide guidance on how to specify the Lepton theme when creating a new project using the ABP CLI? The current documentation only mentions creating projects with the --theme parameter for Basic or Lepton-X themes. However, we are specifically using the Lepton theme. How should the command be structured to use Lepton as the theme?


31 Answer(s)
  • User Avatar
    0
    tahmad created

    Summeye.Kurtulus, I'm experiencing the same issue.

    I tried using --legacy-peer-depth, but the problem persists.

    Is it better to ask about this here, or should I create a new ticket since my issue is quite similar?

  • User Avatar
    0
    sumeyye.kurtulus created
    Support Team Angular Expert

    Thank you for your patience, and I apologize for the delayed response. This problem has been fixed and will be available for the next version. May I know whether you get the same error even if you use the --legacy-peer-deps option?

  • User Avatar
    0
    masum.ulu created
    Support Team Angular Expert

    Hi all clients in this question, about the npm install problem, Have you tried with yarn install command this behavior ?

  • User Avatar
    0
    mert.kir created

    Thank you for your patience, and I apologize for the delayed response. This problem has been fixed and will be available for the next version. May I know whether you get the same error even if you use the --legacy-peer-deps option?

    Hi,

    I also get an error when I try with --legacy-peer-deps

  • User Avatar
    0
    mert.kir created

    Hi all clients in this question, about the npm install problem, Have you tried with yarn install command this behavior ?

    Hi,

    There is no problem when using yarn. The problem is related to npm.

  • User Avatar
    0
    masum.ulu created
    Support Team Angular Expert

    Hi again, if you wanna use npm, currently you need to pass --legacy-peer-deps argument. Command must be like npm i --legacy-peer-deps we'll also planing to change our system from yarn to npm by default. We're working on install packages withou argument yet currently we need to use this.

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.3.0-preview. Updated on April 16, 2025, 12:13