Not getting output in browser even compilation is successful in angular

Viewed 481
    core.js:4031 Uncaught 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.
    at getCompilerFacade (core.js:4031)
    at Function.get (core.js:26915)
    at getNgModuleDef (core.js:1117)
    at assertNgModuleType (core.js:1296)
    at compileNgModuleFactory__POST_R3__ (core.js:29062)
    at PlatformRef.boo**strong text**tstrapModule (core.js:29309)
    at Module.4431 (main.ts:11)
    at __webpack_require_***strong text***_ (bootstrap:19)
    at __webpack_exec__ (main.js:223)
    at main.js:224

I am getting this kind of error even after updating my npm

1 Answers

according to (https://github.com/angular/angular-cli/issues/16873)(reading the previous link is recommended because I will explain them shortly) this issue can be tackled in these ways:

1-run npm update to update your dependencies.

2-you have an angular.json file which should contain an aot=true, if not simply add it yourself, then add postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points then delete node_modules and package lock file to install again.

3-disable your ivy engine on tsconfig.json file "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true, "enableIvy": false }

4-sometimes if you downgrade your angular Cli version the issue will be solved.

Related