Ethan Conner
Ethan Conner

Reputation: 634

Installing an older version of angular

So, I have Angular 6 installed on my computer, but I'm working with legacy code that used Angular 4. Do I need to install Angular 4, and if so, how?

Upvotes: 1

Views: 2224

Answers (2)

Guidedpirate
Guidedpirate

Reputation: 1

I was having issues with one of my projects that was built using angular 8.0.3 but i stupidly updated angular to angular 9 . Tried everything installing older versions of the cli etc.

simply ran 'yarn' and it installed the correct version that the project was made using.

I love yarn.

Upvotes: -1

Narm
Narm

Reputation: 10844

There have been many changes from Angular v4 to v6. I am assuming when you say "I have Angular 6 installed on my computer" you mean you Globally installed Angular v6.

In that case, to run your project all you will need to do is an npm install in the directory that your projects package.json file is located in. That will installed the specific versions your project requires locally. Be aware when you do run your project with say an ng serve or ng build you will likely get a warning message - something like " your global version is greater than your local version - Angular is using your local version - to prevent getting this message in the future do the following etc..."

If you don't want to disable the message you can always uninstall your Global version (npm uninstall -g @angular/cli)and reninstall targeting the version your project uses. For example if you project is using Angular version4 you can do npm install -g @angular/[email protected]

**Note: I suggest you double check your package.json to verify which versions you're using before installing

Upvotes: 4

Related Questions