3

I have updated my angular cli version and now it showing angular : 5.2.0

I have entire code build in angular4. Can you help me with the steps to downgrade my angularcli version (specific version) so that I have angular4. Here is my current configuration:

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

Global

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

I tried below commands but no luck

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"
  }
}
Kunal Vijan
  • 425
  • 2
  • 9
  • 28

2 Answers2

4
Go to you package.json and change all @angular dependencies to 4.0.0 or any version you want.  
Then do the same for @angular-cli with the version number you want it to be. just like the code below

- Save that file    
- Delete you node-modules folder  
- run `npm install` or `yarn` if you are using yarn. 




 {
    "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.3",
          "@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"
   }
}
Nadhir Falta
  • 5,047
  • 2
  • 21
  • 43
  • @KunalVijan can I see your package.json ? – Nadhir Falta Jan 17 '18 at 14:46
  • I have added into the post – Kunal Vijan Jan 17 '18 at 14:48
  • What version of cli you wanna use ? – Nadhir Falta Jan 17 '18 at 14:51
  • I wanted to use 1.6.3 for cli and angular 4 – Kunal Vijan Jan 17 '18 at 14:52
  • works like charm. thanks I can see angular 4 now. `Angular CLI: 1.6.3 Node: 9.2.1 OS: win32 x64 Angular: 4.0.0 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router, tsc-wrapped @angular/cli: 1.6.3 @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 @schematics/angular: 0.1.13 @schematics/schematics: 0.0.13 typescript: 2.5.3 webpack: 3.10.0` – Kunal Vijan Jan 17 '18 at 14:58
  • Cool!! You're welcome, the ^ sign tells npm to always get the latest version – Nadhir Falta Jan 17 '18 at 15:00
1

Because the angular package name has changed:

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

Also please note that the @angular/cli version and then angular version are mutually exclusive.

If you want to downgrade the version of angular for your project only, then change the angular version in your package.json.

Zze
  • 18,229
  • 13
  • 85
  • 118