My npm version is 5.5.1 and angular cli version is 6.2.1. When I try to create a new project using the command ng new Project_name
then it is creating the latest version of Angular (in my case it is creating Angular version ^6.1.0), but I want Angular 4.
My question is how do I create a new Angular 2/4/5 project using a specific version, instead of the latest version?
I don't think changing the version value in package.json will help in my case because there are some differences in the older versions and the latest 6 version (like the name of one file has been changed from angular-cli.json to angular.json and not only name but content is also changed).
I've also raised the same question on the angular-cli GitHub site.
Using CLI you can not create a specific angular version.
But you can install a specific version of angular CLI into a particular folder.
For Example:
First create new folder
inside any drive. I'm going to create a demo folder in D drive. Ex: d:\projects\demo
.
Then find this folder inside Command Prompt(cmd)
or just type cmd
into your created folder address bar in Windows and hit enter.
Now type angular specific version command: npm install @angular/cli@1.7.x
for angular 5. and use a similar command for the other version.
After completing the installation, just create a new angular project in your specific folder that you recently installed angular. Ex: d:\projects\demo\
.
Now create an angular project using the command npx ng new Project_name
and it will create a your specific angular version
Project.
In my example, it will create an angular 5 project.