title: Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded! in angular 9
body: <p>I create a webaite with angular 9 but i have a problem with angular .</p>
  <p>In some route I have the error:</p>
  <pre><code>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 &quot;@angular/compiler&quot;;' 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 &quot;@angular/compiler&quot;;' before bootstrapping.
  </code></pre>
  <p>But in some routes I do not have this error. Another weird thing is that in local it works fine but in server it did not work. What's the problem and how can I solve it?</p>
  <p>In my server I place the put the files in the <code>app</code> folder, while in the local machine I don't have this folder.</p>
  <p>Here is <code>angular.json</code>:</p>
  <pre><code>{
      &quot;$schema&quot;: &quot;./node_modules/@angular/cli/lib/config/schema.json&quot;,
      &quot;version&quot;: 1,
      &quot;newProjectRoot&quot;: &quot;projects&quot;,
      &quot;projects&quot;: {
          &quot;avastar&quot;: {
              &quot;root&quot;: &quot;&quot;,
              &quot;sourceRoot&quot;: &quot;src&quot;,
              &quot;projectType&quot;: &quot;application&quot;,
              &quot;prefix&quot;: &quot;kt&quot;,
              &quot;schematics&quot;: {
                  &quot;@schematics/angular:component&quot;: {
                      &quot;style&quot;: &quot;scss&quot;
                  }
              },
              &quot;architect&quot;: {
                  &quot;build&quot;: {
                      &quot;builder&quot;: &quot;@angular-devkit/build-angular:browser&quot;,
                      &quot;options&quot;: {
                          &quot;outputPath&quot;: &quot;dist/avastar&quot;,
                          &quot;index&quot;: &quot;src/index.html&quot;,
                          &quot;main&quot;: &quot;src/main.ts&quot;,
                          &quot;polyfills&quot;: &quot;src/polyfills.ts&quot;,
                          &quot;tsConfig&quot;: &quot;src/tsconfig.app.json&quot;,
                          &quot;assets&quot;: [
                              &quot;src/favicon.png&quot;,
                              &quot;src/assets&quot;
                          ],
                          &quot;styles&quot;: [
                              &quot;src/styles.scss&quot;
                          ],
                          &quot;scripts&quot;: [
                              &quot;src/assets/vendors/global/vendors.bundle.js&quot;,
                              &quot;src/assets/js/demo1/scripts.bundle.js&quot;
                          ],
                          &quot;stylePreprocessorOptions&quot;: {
                              &quot;includePaths&quot;: [
                                  &quot;src&quot;,
                                  &quot;src/stylings/&quot;,
                                  &quot;src/stylings/base/&quot;,
                                  &quot;src/stylings/kt-customs/&quot;
                              ]
                          },
                          &quot;es5BrowserSupport&quot;: true
                      },
                      &quot;configurations&quot;: {
                          &quot;production&quot;: {
                              &quot;fileReplacements&quot;: [{
                                  &quot;replace&quot;: &quot;src/environments/environment.ts&quot;,
                                  &quot;with&quot;: &quot;src/environments/environment.prod.ts&quot;
                              }],
                              &quot;optimization&quot;: true,
                              &quot;outputHashing&quot;: &quot;all&quot;,
                              &quot;sourceMap&quot;: false,
                              &quot;extractCss&quot;: true,
                              &quot;namedChunks&quot;: false,
                              &quot;aot&quot;: true,
                              &quot;extractLicenses&quot;: true,
                              &quot;vendorChunk&quot;: false,
                              &quot;buildOptimizer&quot;: true,
                              &quot;budgets&quot;: [{
                                  &quot;type&quot;: &quot;initial&quot;,
                                  &quot;maximumWarning&quot;: &quot;5mb&quot;,
                                  &quot;maximumError&quot;: &quot;10mb&quot;
                              }]
                          }
                      }
                  },
                  &quot;serve&quot;: {
                      &quot;builder&quot;: &quot;@angular-devkit/build-angular:dev-server&quot;,
                      &quot;options&quot;: {
                          &quot;browserTarget&quot;: &quot;avastar:build&quot;
                      },
                      &quot;configurations&quot;: {
                          &quot;production&quot;: {
                              &quot;browserTarget&quot;: &quot;avastar:build:production&quot;
                          }
                      }
                  },
                  &quot;extract-i18n&quot;: {
                      &quot;builder&quot;: &quot;@angular-devkit/build-angular:extract-i18n&quot;,
                      &quot;options&quot;: {
                          &quot;browserTarget&quot;: &quot;avastar:build&quot;
                      }
                  },
                  &quot;test&quot;: {
                      &quot;builder&quot;: &quot;@angular-devkit/build-angular:karma&quot;,
                      &quot;options&quot;: {
                          &quot;main&quot;: &quot;src/test.ts&quot;,
                          &quot;polyfills&quot;: &quot;src/polyfills.ts&quot;,
                          &quot;tsConfig&quot;: &quot;src/tsconfig.spec.json&quot;,
                          &quot;karmaConfig&quot;: &quot;src/karma.conf.js&quot;,
                          &quot;styles&quot;: [
                              &quot;src/styles.scss&quot;
                          ],
                          &quot;scripts&quot;: [],
                          &quot;assets&quot;: [
                              &quot;src/assets&quot;
                          ]
                      }
                  },
                  &quot;lint&quot;: {
                      &quot;builder&quot;: &quot;@angular-devkit/build-angular:tslint&quot;,
                      &quot;options&quot;: {
                          &quot;tsConfig&quot;: [
                              &quot;src/tsconfig.app.json&quot;,
                              &quot;src/tsconfig.spec.json&quot;
                          ],
                          &quot;exclude&quot;: [
                              &quot;**/node_modules/**&quot;
                          ]
                      }
                  }
              }
          },
          &quot;avastar-e2e&quot;: {
              &quot;root&quot;: &quot;e2e/&quot;,
              &quot;projectType&quot;: &quot;application&quot;,
              &quot;prefix&quot;: &quot;&quot;,
              &quot;architect&quot;: {
                  &quot;e2e&quot;: {
                      &quot;builder&quot;: &quot;@angular-devkit/build-angular:protractor&quot;,
                      &quot;options&quot;: {
                          &quot;protractorConfig&quot;: &quot;e2e/protractor.conf.js&quot;,
                          &quot;devServerTarget&quot;: &quot;avastar:serve&quot;
                      },
                      &quot;configurations&quot;: {
                          &quot;production&quot;: {
                              &quot;devServerTarget&quot;: &quot;avastar:serve:production&quot;
                          }
                      }
                  },
                  &quot;lint&quot;: {
                      &quot;builder&quot;: &quot;@angular-devkit/build-angular:tslint&quot;,
                      &quot;options&quot;: {
                          &quot;tsConfig&quot;: &quot;e2e/tsconfig.e2e.json&quot;,
                          &quot;exclude&quot;: [
                              &quot;**/node_modules/**&quot;
                          ]
                      }
                  }
              }
          }
      },
      &quot;defaultProject&quot;: &quot;avastar&quot;
  }
  </code></pre>