3

I have latest angular cli with version 7.7.3. I need angular 6 project using it. But I can able to create only angular 7 project from it using cli command ng new project_name. Is there any way to force create angular 6 project? Node version : 10.2.1. From git we can get seed but is it possible from latest cli?

user1365067
  • 95
  • 3
  • 13

3 Answers3

3

The easiest way to do it would be too uninstall angular/cli globally

npm uninstall -g @angular/cli

then reinstall it globally at the version you want so..

npm install -g @angular/cli@6.0.0`

then in your terminal create a new angular project like so

ng new <project-name>

at that point it will build you an angular 6 app, from there you can now safely uninstall the @angular/cli globally and reinstall the latest version like so

npm install -g @angular/cli@latest
Smokey Dawson
  • 8,827
  • 19
  • 77
  • 152
3

The following steps helped me to create angular 6 project from angular cli 7.3.3

Step 1 Create a new folder => mkdir angular6-project

Step 2 Go to that folder => cd angular6-project

Step 3 Check version => ng version so version is > Angular cli: 7.3.3

Step 4 that folder open cmd > npm init -y

Step 5 install angular cli 6 locally using > npm install @angular/cli@6

Step 6 check ng version it's version is > Angular 6.1

Step 7 You delete local pakcage.json file. Angular cli will complain when you try use ng new

Step 8 You can create Angular 6 application > ng new ng6-app

1

There is no way to create the older version of the angular project using the newer version of angular-cli.

To solve your issue you need to downgrade the angular-cli version 7.7.3 to 6.0.0 using below commands

Step 1: Uninstall current angular-cli 7.7.3 using below command

npm uninstall -g @angular/cli

Step 2: Install angular-cli 6.0.0 using below command

npm install -g @angular/cli@6.0.0

Step 3: Create Angular 6 Project using below command

ng new PROJECT-NAME
cd PROJECT-NAME
ng serve

Step 4: Now your project has its own local angular-cli installed,so you can now update your angular-cli version to 7.7.3 using below command

npm install -g @angular/cli@latest

Hope this help!

TheParam
  • 10,113
  • 4
  • 40
  • 51