I installed @angular/cli
package via npm, using this command:
npm install -g @angular/cli
The version 1.4.2 of @angular/cli has been successfully installed. But 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? 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: ...
.
ng version will not provide you angular version. you need to check package.json to know the angular version
@SureshKamrushi i can second this, it displayed everything except the version
ng version
does provide de Angular version if you are on the project folder.If you are in the project folder ng version will provide the version of angular the project is using along with other information like Angular cli version, node version, TypeScript version, webpack version, rxjs version etc.