66

I'm using angular 2.4.9 for my application development so I need to use specific version of ng cli instead of the latest one.

I know the below command will install latest version of ng cli

npm install -g @angular/cli

But how can I install specific version of ng cli?

Gangadhar Jannu
  • 4,136
  • 6
  • 29
  • 49

3 Answers3

157

This command would install the 1.0.0 version:

npm install -g @angular/cli@1.0.0

You can see the available versions with the following command:

npm view @angular/cli

NB: You can also install the latest available version:

npm install @angular/cli@latest
Akostha
  • 679
  • 7
  • 8
Ploppy
  • 14,810
  • 6
  • 41
  • 58
7

npm install -g @angular/cli@{version-number}

Nweke
  • 79
  • 1
  • 3
4

In case anyone stumbles on this question while looking for a way to use angular-cli to build Angular 2 apps, @angular/cli@1.0.0 generated apps installs angular 4.0.0 instead of 2xx.

To avoid the round-trip of uninstalling the cli and looking for the most recent version that builds 2xx, use @angular/cli@1.0.0-beta.33.1

It builds Angular 2.4.1 ;)

Nnanyielugo
  • 401
  • 4
  • 13
  • 1
    Precious! Thank you, @Nnanyielugo - huge help for someone who's picking up old Ng2 legacy code to bring him to life on Ng9! – Pedro Ferreira Mar 04 '20 at 11:48