close

[Solved] Uncaught (in promise): Error: Angular JIT compilation failed: ‘@angular/compiler’ not loaded! in angular 9

Hello Guys, How are you all? Hope You all Are Fine. Today In some route I have the error Uncaught (in promise): Error: Angular JIT compilation failed: ‘@angular/compiler’ not loaded! in angular 9 In angular. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Uncaught (in promise): Error: Angular JIT compilation failed: ‘@angular/compiler’ not loaded! in angular 9 Error Occurs ?

I am working on an Angular project and In some routes, I have the error.

ERROR Error: Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
  - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
  - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
  - Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.
Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
  - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
  - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
  - Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.

How To Solve Uncaught (in promise): Error: Angular JIT compilation failed: ‘@angular/compiler’ not loaded! in angular 9 Error ?

  1. How To Solve Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded! in angular 9 Error?

    To Solve Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded! in angular 9 Update all the dependencies in your node-modules (This issue can be generated due to incompatibility of some dependency versions) run npm update in the project terminal to update all dependencies.

Solution 1: use MatDialogModule instead of MatDialog

whenever you add a new material module to app.module.ts you must stop (and restart) ng serve or you will get this error. And also Change this line.

imports: [
   MatDialog, // <====== this is the error
],

to this

imports: [
   MatDialogModule, // <====== this is the solution
],

Solution 2: Update all the dependencies

Just

Update all the dependencies in your node-modules (This issue can be generated due to incompatibility of some dependency versions) run npm update in the project terminal to update all dependencies.

Solution 3: Add aot= true in angular.json

Just add

aot= true

in angular.json and add

"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"

in package.json and then delete node_modules and package lock file and install again.

Solution 4: Just downgrade the angular cli version

Just downgrade the angular CLI version globally. Because this issue has not been bugging in angular CLI versions 8 and 7.

ng --version
npm uninstall -g @angular/cli
npm cache clean --force

npm install -g @angular/[email protected]
ng --version

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Please Rate Our Solution to Motivate Us For Give Our Best

1 thought on “[Solved] Uncaught (in promise): Error: Angular JIT compilation failed: ‘@angular/compiler’ not loaded! in angular 9”

Leave a Comment