I searched through google and angular cli doc but couldn't find any way to install a specific version of Angular using Angular CLI. is it even possible?
-
3There is no direct way, but you can create a new project then just change the versions in the `package.json` to whatever you want. – Dinistro Apr 11 '17 at 11:36
-
1You can check this answer https://stackoverflow.com/a/52067532/2275011 it worked for me – Ferie Dec 17 '18 at 19:08
25 Answers
To answer your question, let's assume that you are interested in a specific angular version and NOT in a specific angular-cli version (angular-cli is just a tool after all).
A reasonnable move is to keep your angular-cli version alligned with your angular version, otherwise you risk to stumble into incompatibilities issues. So getting the correct angular-cli version will lead you to getting the desired angular version.
From that assumption, your question is not about angular-cli, but about npm.
Here is the way to go:
[STEP 0 - OPTIONAL] If you're not sure of the angular-cli version installed in your environment, uninstall it.
npm uninstall -g @angular/cli
Then, run (--force flag might be required)
npm cache clean
or, if you're using npm > 5.
npm cache verify
[STEP 1] Install an angular-cli specific version
npm install -g @angular/cli@wished.version.here
[STEP 2] Create a project
ng new you-app-name
The resulting white app will be created in the desired angular version.
NOTE: I have not found any page displaying the compatibility matrix of angular and angular-cli. So I guess the only way to know what angular-cli version should be installed is to try various versions, create a new project and checkout the package.json
to see which angular version is used.
angular versions changelog Here is the changelog from github reposition, where you can check available versions and the differences.

- 20,030
- 7
- 43
- 238

- 6,100
- 6
- 41
- 47
-
While following your steps, during npm install -g @angular-cli@1.7.4 getting error like this npm ERR! Invalid package name "@angular-cli": name can only contain URL-friendly characters – MPPNBD May 10 '18 at 21:06
-
3
-
@avi.elkharrat , Oh sorry for that,i missed that. npm install -g @angular/cli@1.7.4 worked for me. Thanks a lot avi.elkharrat – MPPNBD May 11 '18 at 15:21
-
npm uninstall -g @angular/cli -> after I run this cmd, I found that angular is still there. – ankit singh Jun 25 '21 at 08:57
-
You can just have package.json
with specific version and do npm install
and it will install that version.
Also you don't need to depend on angular-cli
to develop your project.

- 25,246
- 15
- 42
- 71

- 7,500
- 14
- 42
- 62
-
20But you should be depending on the CLI IMO. BTW no longer angular-cli but `angular/cli` now. Also, it's `npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest` – Ben Racicot Jun 17 '17 at 15:13
-
As you said edit package.json file, But where is located this package.json file? – Yagnesh bhalala Jul 10 '18 at 06:54
-
You add package.json automatically by doing npm init or manually creating it in your root folder of the project – Mario Petrovic Jul 10 '18 at 08:25
-
After changing version in `package.json`, make sure to perform `npm install`. – Shayma Pathan Mar 05 '21 at 19:03
Edit #2 ( 7/2/2017)
If you install the angular cli right now, you'd probably have the new name of angular cli which is @angular/cli
, so you need to uninstall it using
npm uninstall -g @angular/cli
and follow the code above. I'm still getting upvotes for this so I updated my answer for those who want to use the older version for some reasons.
Edit #1
If you really want to create a new project with previous version of Angular using the cli, try to downgrade the angular-cli before the final release. Something like:
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@1.0.0-beta.32
Initial
You can change the version of the angular in the package.json . I'm guessing you want to use older version of angular but I suggest you use the latest version. Using:
ng new app-name
will always use the latest version of angular.
-
1
-
1@sajad that's unfortunate. I think you can create a previous version of angular from cli. I'll edit my answer – brijmcq Apr 11 '17 at 14:18
-
@brijmq I have personally never seen angular-cli "always use the latest version of angular". For example, right now if you update the cli (1.1.3) globally and create a new project with it, you will get angular 4.0.0 even though the latest is 4.2.4. So what I've been trying to figure out for ages is does the version get updated periodically with new cli releases? – Jason Simpson Jun 22 '17 at 05:51
-
@epiphanatic my bad and sorry for the confusion.the cli will use the latest version of angular at that time when the cli update was made. You will need to manually update it on your package.json on your app if you want to update it. The release of updates in angular is much faster than angular-cli. Take a look at this link to know more http://angularjs.blogspot.com/2016/10/versioning-and-releasing-angular.html . Hope it clears your confusion – brijmcq Jun 22 '17 at 06:24
-
1Just to add that `npm cache clean` did not work for me and I had to use `npm cache clean --force` – Kaloyan Stamatov May 23 '18 at 08:29
-
@brijmcq The install is also new, it needs to be in the format like `npm install -g @angular/cli@6.0.7` also noted by [the answer by](https://stackoverflow.com/a/48282236/1558269) avi.elkharrat. – JabberwockyDecompiler Jul 05 '18 at 22:03
-
I suppose `npm cache clean` is not required because it gives you `npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use npm install --cache /tmp/empty-cache to use a temporary cache instead of nuking the actual one.` – Paramvir Singh Karwal Apr 18 '19 at 13:27
-
The package `angular-cli` has been renamed `@angular/cli` so you need to do something like `npm install -g @angular/cli@v8.3.27` – slucas Jun 29 '20 at 16:38
The angular/cli
versions and their installed angular/compiler
versions:
- 1.0 - 1.4.x = ^4.0.0
- 1.5.x = ^5.0.0
- 1.6.x - 1.7.x = ^5.2.0
- 6.x = ^6.0.0
- 7.x = ^7.0.0
Can be confirmed by reviewing the angular/cli
's package.json
file in the repository newer repository master repository. One would have to install the specific cli version to get the specific angular version:
npm -g install @angular/cli@1.5.* # For ^5.0.0

- 5,461
- 3
- 36
- 35
-
1I have Angular 11 installed globally on my computer, but I needed to create a new project in 6. Based on above info, I did this in three steps: 1) created a new dir 2) npm install @angular/cli@6.* 3) ng new [angular-six-project-name] – Andrew Koper Mar 13 '21 at 04:58
-
npx @angular/cli@10 new my-poject
you can replace 10 with your version of choice... no need to uninstall your existing CLI! Just learnt that now...

- 1,815
- 1
- 17
- 17
-
1This answer should have much more votes. Worse to mention that you might get an `error: npm version 7.20.5 detected. The Angular CLI currently requires npm version 6.`. That can be fixed with `npm install --global npm@6` – Jonathan Sep 15 '21 at 11:25
-
Perfect and easiest solution. Lets you install an earlier version of Angular for a new project than the version in the global command line interface. Thanks for sharing. – Neil Cresswell Sep 28 '22 at 13:24
Yes, it's possible to install a specific version of Angular using npm:
npm install -g @angular/cli@8.3.19
Next, you need to use the ng new command to create an Angular project based on the specific version you used when installing the CLI:
ng new your-project-name
This will generate a project based on Angular v8.3.19, the version which was specified when installing Angular CLI.

- 231
- 2
- 3
Use the following command to install and downgrade the specific version.
uninstall cli
npm uninstall -g @angular/cli
clean npm cache
npm cache clean --force
install cli
npm install -g @angular/cli@_choose_your_version

- 530
- 4
- 13
Specify the version you want in the 'dependencies' section of your package.json, then from your root project folder in the console/terminal run this:
npm install
For example, the following will specifically install v4.3.4
"dependencies": {
"@angular/common": "4.3.4",
"@angular/compiler": "4.3.4",
"@angular/core": "4.3.4",
"@angular/forms": "4.3.4",
"@angular/http": "4.3.4",
"@angular/platform-browser": "4.3.4",
"@angular/platform-browser-dynamic": "4.3.4",
"@angular/router": "4.3.4",
}
You can also add the following modifiers to the version number to vary how specific you need the version to be:
caret ^
Updates you to the most recent major version, as specified by the first number:
^4.3.0
will load the latest 4.x.x release, but will not load 5.x.x
tilde ~
Update you to the most recent minor version, as specified by the second number:
~4.3.0
will load the latest 4.3.x release, but will not load 4.4.x

- 28,994
- 18
- 176
- 206
If you still have problems and are using nvm make sure to set the nvm node environment.
To select the latest version installed. To see versions use nvm list
.
nvm use node
sudo npm remove -g @angular/cli
sudo npm install -g @angular/cli
Or to install a specific version use:
sudo npm install -g @angular/cli@7.2
If you dir permission errors use:
sudo npm install -g @angular/cli@7.2 --unsafe-perm

- 449
- 5
- 5
I have Angular 11 installed globally on my computer, but I needed to create a new project in Angular 6. Based on the CLI version to Angular version info in Robert Brisita's answer on this question, these steps did it for me:
created [angular-six-dir]
cd [angular-six-dir]
npm install @angular/cli@6.*
ng new [angular-six-project-name]

- 6,481
- 6
- 42
- 50
-
This works great, but after doing this, it's a good idea to delete the extra outer `package-lock.json` and `node_modules` folder. (The extra ones which get created outside the angular project.) – Eliezer Berlin Jul 14 '21 at 13:56
-
You can also use npx to generate applications in previous versions
For example:
#Angular 11: last CLI version 11
npx -p @angular/cli@11.1.2 ng new Angular11App

- 4,894
- 8
- 52
- 83
reinstalling global package is difficult every time instead i do this to manage multiple projects of different angular versions in my workspace.
mkdir <new workspace>
cd <new workspace>
npm init
npm i @angular/cli@12.2.18
you can use any version
ng -v
Your global Angular CLI version (13.3.2) is greater than your local version (12.2.18). The local Angular CLI version is used.
ng new <project name>
cd <project name>
cat package.json
you can see the angular version is 12

- 31
- 2
Execute this command in the command prompt and you will be good to go
npm install -g @angular/cli@version_name

- 51
- 4
This work for me.
Open CMD in folder "C:\Users\YourUser\source\repos"
npm uninstall -g @angular/cli
npm cache clean
npm cache verify
npm install -g @angular/cli
Try again after that.

- 29,388
- 11
- 94
- 103

- 71
- 1
- 3
just
sudo npm -g install @angular/cli@11.2.10
for list of valid version plz check link below Angular CLi Versions

- 5,304
- 1
- 17
- 20
Use this command to install any your desired angular version app:
npx -p @angular/cli ng new hello-project
- Install
npx
usingnpm i -g npx
if not already installed.Angular CLI versions indicate which angular version will be installed e.g.
@angular/cli@^7.0.0
creates angular 7 projects,
@angular/cli@^9.0.0
creates angular 9 projects &
@angular/cli@latest
or just@angular/cli
creates latest stabel versioned Angular app.

- 4,682
- 1
- 34
- 40
use the following command to install the specific version. say you want to install angular/cli version 1.6.8 then enter the following command :
sudo npm install -g @angular/cli@1.6.8
this will install angular/cli version 1.6.8

- 958
- 2
- 18
- 35

- 27
- 2
I would suggest using NVM to keep different versions of node and npm and then install the compatible angular-cli

- 3,964
- 1
- 21
- 37
npm install -g @angular/cli@6.1.1
##Then you can check the version by##
ng --version

- 29,388
- 11
- 94
- 103

- 171
- 1
- 7
Use CMD run as administrator, command like this
npm i @angular/cli@11.2.18
npm i -g @angular/cli@11.2.18
npm install @angular/cli@11.2.18
npm install -g @angular/cli@11.2.18
Get exist version like this https://www.npmjs.com/package/@angular/cli/v/12.2.16

- 46,709
- 59
- 215
- 313
Im my case I had nx workspace, where I had another Angular app with old version, so I had @angular/cli
installed locally with the older version. So when I tried to add a new app I got warning: Your global Angular CLI version (14.1.2) is greater than your local version (11.2.0). The local Angular CLI version is used.
. So, you can install locally whatever version you need and it will be used

- 56
- 2
You don't need to uninstall your current globally installed angular cli. You can install a specific cli version locally and finish your project. Also, remember that angular cli also depends on a specific version of nodejs. So use nvm to install a specific nodejs version that is compatible with your locally installed angular cli. Follow these steps:
Step 1:
nvm install vX.Y.Z
where X.Y.Z is nodejs version that is compatible with your angular cli version.
Step 2:
nvm use vX.Y.Z
Step 3:
npx @angular/cli@X.Y.Z new my-poject
where X.Y.Z is your desired version
Step 4:
cd my-project && ng serve
Now angular cli is using locally installed version instead of globally installed cli. You can ignore the version mismatch warnings.

- 21
- 4
No need to update angular and all just downgrade material and cdk version to 14.2.7 version which is compatable with Angular 14. Uninstall latest versions : npm uninstall @angular/material @angular/cdk --legacy-peer-deps Install 14.2.7 version npm install @angular/material@14.2.7 --force npm install @angular/cdk@14.2.7 --force