web-dev-qa-db-fra.com

Comment déclasser la version de Angular Cli

J'ai mis à jour ma version de cli angulaire et la montre maintenant angulaire: 5.2.0 

J'ai l'intégralité du code construit dans angular4. Pouvez-vous m'aider avec les étapes pour rétrograder ma version d'angularcli (version spécifique) afin que je possède angular4. Voici ma configuration actuelle:

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:
...

J'ai essayé en dessous des commandes mais pas de chance

npm uninstall -g angular-cli
npm cache clean
npm install -g [email protected]

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"
  }
}
3
Kunal Vijan
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"
   }
}
4
Nadhir Falta

Parce que le nom du paquet angulaire a changé:

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

Veuillez également noter que la version @angular/cli puis la version angulaire s’excluent mutuellement.

Si vous souhaitez rétrograder la version d'angular pour votre projet uniquement, modifiez la version angular dans votre package.json.

1
Zze