_this.host.getOutputName中的Angular 5 ERROR不是函数

时间:2018-02-01 09:17:16

标签: javascript angular angular-cli

我真的不知道为什么,但是当我从Angular 4升级时=> 5,ng serve似乎无法正常工作并抛出错误:

  

_this.host.getOutputName中的错误不是函数

     

webpack:无法编译。

这就是我的包装:

{
  "name": "website",
  "version": "0.0.0",
  "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",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0",
    "core-js": "^2.4.1",
    "jquery": "^3.2.1",
    "ngx-textarea-autosize": "^1.1.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.2.0",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/jquery": "^3.2.16",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "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.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}

2 个答案:

答案 0 :(得分:5)

已知问题https://github.com/angular/angular/issues/21621

考虑安装相同版本的角度依赖项:

"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",

然后在你的devDependencies中我看到了

"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",

答案 1 :(得分:1)

尝试设置

"@angular/compiler-cli": "^5.0.0"
你的devDependencies中的