There are three ways in which you can check Angular Version (or Angular CLI Version)
- Use the command
ng version
(orng v
) to find the version of Angular CLI in the current folder. Run it outside of the Angular project, to find out the globally installed version of Angular. - Use the
npm list --depth 0
to find out the list of packages installed in the current folder. Add the-g
(global) flag (npm list -g --depth 0
), to find the global version. - You can also open the
package.json
and look for the version of@angular/cli
package
Table of Contents
Using ng version
Where you run ng version
(or ng v
) is important.
If you run it inside an Angular project folder, then it will list the locally installed Angular CLI Version
Run it outside the Angular folder to find out the globally installed Angular Version.
1 2 3 4 5 6 7 | ng version or ng v |
Output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Angular CLI: 11.1.1 Node: 12.18.3 OS: win32 x64 Angular: ... Ivy Workspace: Package Version ------------------------------------------------------ @angular-devkit/architect 0.1101.1 (cli-only) @angular-devkit/core 11.1.1 (cli-only) @angular-devkit/schematics 11.1.1 (cli-only) @schematics/angular 11.1.1 (cli-only) @schematics/update 0.1101.1 (cli-only) |
Local Version
Here we run the ng v
in an Angular 8 project folder
1 2 3 | ng v |
Output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | Your global Angular CLI version (11.1.1) is greater than your local version (8.0.6). The local Angular CLI version is used. To disable this warning use "ng config -g cli.warnings.versionMismatch false". Angular CLI: 8.0.6 Node: 12.18.3 OS: win32 x64 Angular: 8.0.3 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.800.6 @angular-devkit/build-angular 0.800.6 @angular-devkit/build-optimizer 0.800.6 @angular-devkit/build-webpack 0.800.6 @angular-devkit/core 8.0.6 @angular-devkit/schematics 8.0.6 @angular/cli 8.0.6 @ngtools/webpack 8.0.6 @schematics/angular 8.0.6 @schematics/update 0.800.6 rxjs 6.4.0 typescript 3.4.5 webpack 4.30.0 |
Using npm list
npm command npm list
gives the packages installed in the current folder.
The global flag -g
(or --global
) lists all packages installed globally.
We must also include the flag --depth 0
, which lists only the top-level packages. Use --depth 1
, --depth 2
, etc., to discover the version of dependencies.
1 2 3 | npm list -g --depth 0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | +-- @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
This will give you packages installed in the current folder. We run it on an Angular 8 project folder.
1 2 3 | npm list --depth 0 |
output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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
Open the package.json
file and look for the @angular/cli
under the devDependencies
node.
Here is a typical package.json
file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | { "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" } } |
does not work
ng version is the syntax