Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 5 ERROR in _this.host.getOutputName is not a function

I really don't know why but when I upgraded from Angular 4 => 5, ng serve doesn't seem to be working and is throwing an error:

ERROR in _this.host.getOutputName is not a function

webpack: Failed to compile.

This is what my package looks like:

{
  "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"
  }
}
like image 350
Rusty Avatar asked Feb 01 '18 09:02

Rusty


2 Answers

It's known issue https://github.com/angular/angular/issues/21621

Consider installing the same versions of angular dependencies:

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

but then in your devDependencies I see

"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",
like image 99
yurzui Avatar answered Oct 30 '22 04:10

yurzui


try setting

"@angular/compiler-cli": "^5.0.0"

in your devDependencies

like image 1
David Avatar answered Oct 30 '22 05:10

David