@ angular / compiler-cli的版本必须为2.3.1或更高。当前版本为“未定义”

时间:2018-12-24 12:26:39

标签: javascript angular angular-cli

我在进行ng服务时遇到以下错误。

@ angular / compiler-cli的版本必须为2.3.1或更高。当前版本为“未定义”。

我的包json看起来像这样

"dependencies": {
    "@angular/common": "2.2.3",
    "@angular/compiler": "^7.1.4",
    "@angular/core": "2.2.3",
    "@angular/forms": "2.2.3",
    "@angular/http": "2.2.3",
    "@angular/platform-browser": "2.2.3",
    "@angular/platform-browser-dynamic": "2.2.3",
    "@angular/router": "3.2.3",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "webpack": "^2.7.0",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^7.1.4",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "^4.0.2",
    "typescript": "^3.1.1",
    "webdriver-manager": "10.2.5"
  }

这是我的ng -v信息

  ng -v
angular-cli: 1.0.0-beta.22-1
node: 8.2.1
os: darwin x64

1 个答案:

答案 0 :(得分:0)

该项目需要@ angular / compiler-cli的开发依赖项。

npm install --save-dev @angular/compiler-cli@<your angular version>