Angular 8.5报错:Angular JIT compilation failed: ‘@angular/compiler‘ not loaded!

  • Post author:
  • Post category:其他


Angular 8.5报错:Angular JIT compilation failed: ‘@angular/compiler’ not loaded!



错误的具体原因

未知,先记录一下,日后深挖。



解决方法

翻看了很多博客给出的解决方法,以下解决方法出自:https://stackoverflow.com/questions/60690670/uncaught-in-promise-error-angular-jit-compilation-failed-angular-compiler/64148923

  1. Turn off the AOT by changing “aot”: true to “aot: false in angular.json file. I would not recommend this as this improves the performance of the Angular app and improves the catching of error codes in development mode.

  2. If you don’t want to change in angular.json and wants to fix this issue for ionic serve only, pass the –aot=false flag to ng command by using –:

    ionic serve -- --aot=false

  3. . If none the solutions above are working for you, you can run a command npm update which will update literally all the dependencies from your package.json (that means, Ionic dependencies will also be updated).

    This is a blind option because you won’t have an idea that which dependencies are updated and what are the breaking changes in those updated dependencies. So you might end up fixing other issues because of this.

    So it’s up to you to take this risk 😃 Well, this is worth doing if your app is not that big or not using any codes which are removed in the newer dependencies.;

  4. Add import ‘@angular/compiler’; in main.ts file. But this might increase the bundle size.

  5. While upgrading Ionic, you might face another issue because of wrong import in polyfills.ts. If yes, check out src/zone-flags.ts is missing from the TypeScript compilation after upgrading to Ionic 5



我的解决方法

npm install



版权声明:本文为ACDERQWE原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。