How to create an Angular v5 project when your global CLI version is 6.x
Recent release of Angular v6.0 brought quite a lot of welcome features and not many but pseudo breaking changes too. Of course the Angular team has shared a detailed writeup for migration and it is quite impressive how seamless the process is.
The Angular release version cycles appear to be competing with mobile release cycles like the OnePlus and so on.. (pun intended)
Anyhoo, most of us have already upgraded our Angular CLI to version 6.x to play with the latest awesome features. But now and then we might run into a situation that requires creating a new Angular v5 or some older version project.
For me this is quite common as I am not a fan of keeping all dormant/stable projects on disk and rely heavily on repo managers like Github, GitLab etc. This is mainly to avoid my disk becoming a garage storage for such projects and especially their node_modules. Checking out and running npm install
does the trick for such projects, but I ran into a wall when it came to creating a fresh new project with v5 or older version.
As of now Angular CLI is the best (or only) option to bootstrap a new Angular project, I figured I can install an older cli version locally and use it to bootstrap a new project. The image below explains the gist of my workaround.
As mentioned above in the image, you can always install different versions of the Angular CLI and create softlinks to use them in the future. But I would be keen to know if there are any plans to support version
option when running ng new
in future. Hope this helps!