'JIT compilation failed for NgModule class

Here i got an Error like JIT Compilation failed and needed to flag some -aot and etc.. stuff



Solution 1:[1]

It's been solved..!

Many times we import kind of extra package like here... I imported the httpClient package to appModule, but we don't need it.

So check out this kind of uncertain package that might is there.. or once go through all your last working components imports and module imports and angular.json file.

Solution: (1) Checkout appModule imports whether they conflict with other imports or not. (60% cases) (2) Checkout Recent working component files and their imports (30% cases) (3) Once go through your angular.json file (10% cases)

Solution 2:[2]

'JIT compilation failed for NgModule class', I faced yesterday the same error.

But when I checked the 'app.component.ts', found 'MatPaginatorModule' added in below import which was done mistakenly

import {MatPaginator, MatPaginatorModule} from '@angular/material/paginator'

I removed that extra import and then things started working.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 NIHAR SONI
Solution 2 Sumit