Creating Angular 5.1.0 project using Angular/CLI 1.6.0 and verifying version

Few days ago, Angular 5.1.0 stable version has been arrived. You can create new project with latest Angular version by upgrading angular/cli package. By default angular/cli 1.6.0 creates new Angular project with latest version (5.1.0). But there is an interesting point that we will discuss.

Upgrading Angular/CLI version.

Follow steps to upgrade your Angular/CLI version:

Typically you will require to run below commands:

Creating new Angular project

This is simplest step. Just run below command in terminal

ng new ng5.1.0-demo

Once new project is created and dependencies are installed, open package.json file and observe “dependencies” section.

Check out @angular/* version. You will see something like:

"dependencies": {

"@angular/animations": "^5.0.0",

"@angular/common": "^5.0.0",

"@angular/compiler": "^5.0.0",

"@angular/core": "^5.0.0",

"@angular/forms": "^5.0.0",

"@angular/http": "^5.0.0",

"@angular/platform-browser": "^5.0.0",

"@angular/platform-browser-dynamic": "^5.0.0",

"@angular/router": "^5.0.0",

"core-js": "^2.4.1",

"rxjs": "^5.5.2",

"zone.js": "^0.8.14"

},

Hmm, shouldn’t version be 5.1.0 for angular?

Now, open terminal and navigate to your new project directory. Run below command

ng -v

Output shall be something like below:

Angular CLI: 1.6.0
Node: 8.1.3
OS: win32 x64
Angular: 5.1.0
… animations, common, compiler, compiler-cli, core, forms
… http, language-service, platform-browser
… platform-browser-dynamic, router

@angular/cli: 1.6.0
: 0.0.35
: 0.0.22
: 0.0.41
: 1.1.0
: 1.9.0
: 0.1.10
: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

Well, here Angular version is 5.1.0. So what is the issue?

Reason is “SemVer” that is Semantic Versioning. Read some brief about it and you will get an idea.

In package.json file, you can observe version is starting with “caret (^)” symbol. It allow NPM to work with version 5.x. So as there will be another stable version of Angular say 5.1.2 or 5.2.0 still package.json file shall have only ^5.0.0.

We can verify this by another way. Navigate to \node_modules\@angular\core folder inside new project directory and open “package.json” file. Observe the “version” property at the end of file. You should find version is “5.1.0”.

So don’t get panic if you upgrade angular/cli 1.6.0 version and new Angular project’s package.json file have version ^5.0.0. You are safe!

Cheers!

Cloud Solution Architect | Author | Full Stack Developer | https://www.linkedin.com/in/balram-chavan | https://www.hiretheauthor.com/balramchavan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store