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 0to 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.jsonand look for the version of@angular/clipackage
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.
ng version
or
ng vOutput
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
ng vOutput
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.0Using 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.
npm list -g --depth 0+-- @angular/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
Local version
This will give you packages installed in the current folder. We run it on an Angular 8 project folder.
npm list --depth 0output
[email protected] D:\TekTutorialsHub\Angular\Test\Environment
+-- @angular-devkit/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]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
{
"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