如何降级AngularCli版本

时间:2018-01-16 22:15:53

标签: angular version angular-cli downgrade

我更新了我的角度cli版本,现在显示角度:5.2.0

我在angular4中构建了完整的代码。你能帮助我降级我的angularcli版本(特定版本)的步骤,以便我有angular4。 这是我目前的配置:

Angular CLI: 1.6.4
Node: 9.2.1
OS: win32 x64
Angular: 5.2.0
@angular/cli: 1.6.4
@angular-devkit/build-optimizer: 0.0.38
@angular-devkit/core: 0.0.25
@angular-devkit/schematics: 0.0.48
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.4
@schematics/angular: 0.1.13
@schematics/schematics: 0.0.13
typescript: 2.4.2
webpack: 3.10.0

全局

Angular CLI: 1.6.3
Node: 9.2.1
OS: win32 x64
Angular:
...

我尝试过以下命令,但没有运气

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@1.0.0-beta.14

的package.json

    {
  "name": "crud-operation",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "1.6.4",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "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.9.1",
    "typescript": "~2.5.3"
  }
}

2 个答案:

答案 0 :(得分:4)

{{1}}

答案 1 :(得分:1)

因为角度包名称已更改:

npm uninstall -g @angular/cli
npm cache clean
npm install -g  @angular/cli@latest

另请注意,@angular/cli版本和角度版本是互斥的。

如果您只想降级项目的角度版本,请更改angular中的package.json版本。