How to get the Angular version?
I installed the @angular/cli
package via npm using:
npm install -g @angular/cli
The version 1.4.2 of @angular/cli
has been successfully installed. That is not the Angular version, but the CLI version.
After running ng new myapp
how can I check which Angular version the created app is using? 2.x, 4.x?
ng version
You installed angular cli globally (-g in the command). This means that you can type ng version
into your command prompt. It may be more precise to do this when your command prompt is not within a npm controlled directory (you should type this in within directory you typed ng new myapp
).
A note to those who got here from Google: ng version
will let you know which (coarse) version of Angular is referenced by the current directory.
e.g. This directory appears to have angular 4.x (~4.3.0) installed.
@angular/cli: 1.2.1
node: 8.11.1
os: win32 x64
@angular/common: 4.3.0
@angular/compiler: 4.3.0
@angular/core: 4.3.0
@angular/forms: 4.3.0
@angular/http: 4.3.0
@angular/platform-browser: 4.3.0
@angular/platform-browser-dynamic: 4.3.0
@angular/router: 4.3.0
@angular/cli: 1.2.1
@angular/compiler-cli: 4.3.0
If you are not within a directory which has a packages.config, then you will get Angular: ...
.
For Angular 1 or 2 (but not for Angular 4+):
You can also open the console and go to the element tab on the developer tools of whatever browser you use.
Or
Type angular.version to access the Javascript object that holds angular version.
For Angular 4+ There is are the number of ways as listed below :
Write below code in the command prompt/or in the terminal in the VS Code. (up to 3)
- ng version or ng --version (Find the image for the reference)
- ng v
- ng -v
In the terminal you can find the angular version as shown in the attached image :
- You can also open the console and go to the element tab on the developer tools of whatever browser you use. As displayed in the below image :
- Find the package.json file, You will find all the installed dependencies and their version.
You should check package.json file in the project. There you will see all packages installed and versions of those packages.
In Command line we can check our installed ng version.
ng -v OR ng --version OR ng version
This will give you like this :
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.5
Node: 8.0.0
OS: linux x64
Angular:
...