Angular downgrade from version 5 to 4

2019-01-15 14:22发布

问题:

i want to create angular 4 project instead of 5. my angular cli version 1.5.0 when i run this command to downgrade the version to angular cli 4

npm install -g angular-cli@1.4.9

I get the error

npm ERR! code ETARGET
npm ERR! notarget No matching version found for angular-cli@1.4.9

回答1:

If you want to install this specific version of the angular cli you have to use this command:

npm install -g @angular/cli@1.4.9

Perhaps you have an other version currently installed on your system you should read this also.



回答2:

The version of angular used in a project is determined by the version of angular cli installed. any specific version of angular cli can be installed with the following command:

npm install --global @angular/cli@x.x.x.

example:

npm install --global @angular/cli@1.6.6

even if you have another version of angular cli (either newer or older) installed. That won't cause issues.



回答3:

To install Angular 4:

  1. Open CMD
  2. npm install -g @angular/cli@1.4.9

Check all the versions in below link:

npm angular cli versions