user11656896
user11656896

Reputation:

Can I select the version of Angular when creating a new project?

Is it possible to select Angular version when creating a new project? That is, I have installed globally Angular 8 , and I want to create a project on Angular 7. How can this be done without updating all the Angular modules in turn (example: npm i @angular/animations@7, etc.)?

Upvotes: 6

Views: 2337

Answers (3)

Fateh Mohamed
Fateh Mohamed

Reputation: 21377

you can create a local Angular-cli environnement

  • create a new folder and navigate inside
  • run the command: npm init
  • install your cli version: npm install @angular/cli@7 enter image description here
  • remove package.json file and leave only your new created node_modules folder
  • ng new angularApp (this will use your local angular/cli to create your app)
  • now you have your angular app with the specific angular version and you can delete the node_modules folder that is in your environement folder enter image description here

Upvotes: 2

Ismail
Ismail

Reputation: 1316

Try using the Node version Manager. You can install and keep all the version You need and switch between the version for your projects.Very useful for people working in multiple Angular projects in different versions.

Node Version Manager - Simple bash script to manage multiple active node.js versions

Upvotes: 2

Adrita Sharma
Adrita Sharma

Reputation: 22213

You can create a new folder and install angular 7 in it.

npm install @angular/[email protected]

Note: Do not use -g (This is for global installation)

When you will create a new project in that folder with ng new, the version of the app will be 7.

Upvotes: 11

Related Questions