简体   繁体   English

Angular 5 Runtime编译器未加载

[英]Angular 5 Runtime compiler is not loaded

I am compiling my angular project using 我正在使用编译我的角度项目

ng build --prod

But I get 但是我明白了

main.bundle.js:1 ERROR Error: Uncaught (in promise): Error: Runtime compiler is not loaded

I can't figured out what to do. 我不知道该怎么办。 This is my package.json 这是我的package.json

{
  "name": "gestionerADJ",
  "version": "0.0.1",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "bootstrap": "^4.0.0-beta.2",
    "core-js": "^2.4.1",
    "ngx-bootstrap": "^2.0.0-beta.8",
    "rxjs": "5.5.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.5.5",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }
}

I have seen some other questions about this error but none of them is helping me.. Thank you to any of you that are going to help me! 我已经看到了有关此错误的其他问题,但没有一个对我有帮助。.谢谢您对我有帮助!

If you have any modules inside your project you're not lazy-loading, you might want to switch to lazy-loading: 如果您的项目中有任何模块都没有延迟加载,则可能需要切换到延迟加载:

export const routes: Routes = [
    {
        path: '',
        component: myComponent,
        children: [
            {
                path: '',
                loadChildren: myModule
            }
        ]
    }
];

Replace loadChildren: myModule with loadChildren: '../../test.module#myModule' , using the appropriate path for your project. 使用适合您项目的路径,将loadChildren: myModule替换为loadChildren: '../../test.module#myModule'

You make changes in angular.json under option in architect. 您可以在angular.json中的angular.json下的angular.json进行更改。 Add lazy Modules like this: 像这样添加惰性模块:

"lazyModules": [""]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM