How To Check Angular Version

How To Check Angular Version

In this article, we learn how to check the angular version. There are three ways to check the version of Angular (or Angular CLI Version).

  1. The Angular CLI version in the current folder may be found with the command ng —version (or ng -v). Run it outside of the Angular project to determine the version of Angular that is currently deployed worldwide.
  2. To get a list of the packages installed in the current folder, use the npm list —depth 0 commands. To discover the global version, add the -g (global) flag (npm list -g —depth 0).
  3. You can also open the package.json and look for the @angular/cli package version.

Using ng –version

It matters where you run the ng --version (also known as ng v).

The locally installed Angular CLI Version will be listed if you execute it inside an Angular project folder.

To determine the version of Angular deployed globally, run it outside the Angular folder.

ng --version

OR

ng v

Output

Angular CLI Version

Local Version

The ng v is being used here to run an Angular 8 project folder.

ng v

Output

Angular CLI Local Version


Using npm list

command npm list of packages installed in the current folder is provided by the npm list.

All packages installed worldwide are listed using the global flag -g (or --global).

The flag --depth 0, which only lists top-level packages, must also be included. In order to delve deeper and learn the version of dependencies, use --depth 1, --depth 2, etc.

npm list -g --depth 0

+-- @angular/cli@11.1.1
+-- angular-cli@1.0.0-beta.28.3
+-- bower@1.8.4
+-- grunt@1.0.3
+-- gulp@4.0.2
+-- iisexpress-proxy@1.4.4
+-- json-server@0.16.1
+-- lighthouse@6.0.0
+-- nativescript@6.1.2
+-- nodemon@2.0.2
+-- npm@6.13.7
+-- pnpm@4.8.0
+-- rxjs-tslint@0.1.7
+-- tns-android@3.4.3
+-- tslint@5.12.1
+-- typescript@3.5.3
`-- webpack@4.28.4

Local version

You will receive a list of the packages installed in the selected location. On an Angular 8 project folder, we run it.

npm list --depth 0

output

environment@0.0.0 D:\TekTutorialsHub\Angular\Test\Environment
+-- @angular-devkit/build-angular@0.800.6
+-- @angular/animations@8.0.3
+-- @angular/cli@8.0.6
+-- @angular/common@8.0.3
+-- @angular/compiler@8.0.3
+-- @angular/compiler-cli@8.0.3
+-- @angular/core@8.0.3
+-- @angular/forms@8.0.3
+-- @angular/language-service@8.0.3
+-- @angular/platform-browser@8.0.3
+-- @angular/platform-browser-dynamic@8.0.3
+-- @angular/router@8.0.3
+-- @types/jasmine@3.3.16
+-- @types/jasminewd2@2.0.8
+-- @types/node@8.9.5
+-- codelyzer@5.2.0
+-- jasmine-core@3.4.0
+-- jasmine-spec-reporter@4.2.1
+-- karma@4.1.0
+-- karma-chrome-launcher@2.2.0
+-- karma-coverage-istanbul-reporter@2.0.6
+-- karma-jasmine@2.0.1
+-- karma-jasmine-html-reporter@1.4.2
+-- protractor@5.4.2
+-- rxjs@6.4.0
+-- ts-node@7.0.1
+-- tslib@1.10.0
+-- tslint@5.15.0
+-- typescript@3.4.5
`-- zone.js@0.9.1

Using package.json

Look for the @angular/cli beneath the devDependencies node in the package.json file.

Here is an example of a package.json file

{
  "name": "testAngular",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.0.0",
    "@angular/common": "~8.0.0",
    "@angular/compiler": "~8.0.0",
    "@angular/core": "~8.0.0",
    "@angular/forms": "~8.0.0",
    "@angular/platform-browser": "~8.0.0",
    "@angular/platform-browser-dynamic": "~8.0.0",
    "@angular/router": "~8.0.0",
    "rxjs": "~6.4.0",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.800.0",
 
    "@angular/cli": "~8.0.2",
      ==> Angular Version
 
    "@angular/compiler-cli": "~8.0.0",
    "@angular/language-service": "~8.0.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  }
}


Conclusion

In this article, we learn the various ways to check the angular version.

I hope this article helps you and you will like it.👍

If you have any doubt or confusion then free to ask in the comment section.

Post a Comment

Previous Post Next Post