AngularJS (67 Blogs) Become a Certified Professional

How to check the angular version?

Last updated on Oct 21,2024 97 Views

Sunita Mallick
Experienced tech content writer passionate about creating clear and helpful content for... Experienced tech content writer passionate about creating clear and helpful content for learners. In my free time, I love exploring the latest technology.

How to check the angular version

Angular is one of the frameworks widely used to develop web applications. Understanding which version of Angular is installed is crucial for a number of reasons. It can aid you in checking compatibility with other tools and libraries, compliance with the right documentation, and fixing possible problems. Often, developers face some serious issues in executing the codebase. Sometimes, just verifying the version of Angular can fix these issues easily. In this article, we will learn how to check the Angular version in three simple ways. Let us all understand these methods about how to check angular version.

Using ng version 

The ng version command is one of the simplest methods through which we can check the Angular version. This command is one of the Angular CLI commands. This Angular CLI is a tool designed for managing Angular projects.

Steps to Use ng version

Open Terminal or Command Prompt:

  1. On a Mac, one can easily open a terminal by using the Spotlight search feature and typing ‘Terminal’.
  2. On Windows, one can access the command prompt by searching the start menu for “Command Prompt”.

 

Navigate to Your Angular Project Directory:

To get to your project directory, you need to type in the cd command. For instance, if your project is in a folder called ‘my-angular-app’, open the terminal type the following command and press Enter key.

cd my-angular-app

Run the ng version Command:

Now, it is time to run the ‘ng version’ command in the terminal. This will help you to know th Angular version. You can type the following command:

ng version

This command will give you details about the Angular project that you are currently working on. 

Angular CLI: 12.0.0

Node: 14.15.4

OS: darwin x64

Angular: 12.0.0

… common, compiler, compiler-cli, core, forms, language-service

Understanding the Output

If you are wondering how to check angular version, then you need to understand this output:

  • Angular CLI:  This is used to show the version of the Angular Command Line Interface you are using.
  • Node: This shows the version of Node. Specifically, it is the installation of JS programs in your computer system.
  • OS: This refers to the operating system that is used in the current environment.
  • Angular: It gives the version of Angular that is currently installed in your project. It also lists other Angular packages such as common, compiler, compiler-cli, core, forms, and language-service that show that they are of the same version as angular-core.

Using npm list

Another way of how to check angular version is to run the npm list command in the terminal. This command lists all the dependencies within your project, and as you can see, Angular is among them.

Steps to Use npm list

Open Terminal or Command Prompt:

You need to open your terminal or use the command prompt. Here, you have to input the ng version command.

Navigate to Your Angular Project Directory:

Type ‘cd’ then the name of your project’s directory to navigate to that pointed directory. For example:

cd my-angular-app

Run the npm list Command:

Type the following command and press Enter:

npm list @angular/core

This command will print the version of the Angular Core module. The output will look similar to  this:

my-angular-app@0.0.0 /Users/username/my-angular-app

└── @angular/core@12.0.0

Understanding the Output

  • my-angular-app@0.0.0: This shows the name and version of your project.
  • @angular/core: This indicates the Angular core module version which is effectively used in the project.

This method is optimal if you just require information about the version of the Angular core module.

Also Read : How to install ng bootstrap in Angular

Using package.json

The package. json file in your project stores information related to your project, like the dependencies that your project has. From this file, you can see the available version of Angular.

Steps to Use package.json

Open Your Project Directory:

Open your terminal or command prompt and go to the project directory.

Open the package.json File:

  • Find the package. json file in your project directory and then call the configure function passing in the root_url. This file is typically placed in the directory of your home project.
  • Open the package.json file with a text editor. To edit the JSON files, you can use any text editor. The most popular are Notepad on Windows, TextEdit on Mac, and professional-level Visual Studio Code.

Look for @angular/core:

In the package.json file, you should find and focus on the “dependencies” field. It will look something like this:

 

"dependencies": {</b>

<b>&nbsp;&nbsp;"@angular/core": "12.0.0",</b>

<b>&nbsp;&nbsp;"@angular/common": "12.0.0",</b>

<b>&nbsp;&nbsp;"@angular/compiler": "12.0.0",</b>

<b>&nbsp;&nbsp;"@angular/forms": "12.0.0",</b>

<b>&nbsp;&nbsp;...</b>

<b>}

 Also Read What are the Reactive Forms in Angular

Understanding the Information

  • Dependencies: It contains all the packages and their versions that your project requires.
  • @angular/core: This reveals the version of the Angular core module that has been used in your project.

If you list the angular packages from the package.json file, you can see all the versions of the Angular packages your project is using, not only the core module. You can check any Angular Certification Course to understand these methods better.

Also Read : Angular 17 – Know Everything About It

Why Knowing the Angular Version is Important?

Knowing the version of Angular you are using is essential for several reasons:

Compatibility: Previous versions of Angular may not be compatible with new versions or with other libraries and tools. Knowing the version allows you to have an understanding of how all the separate components play well together.

Documentation: Angular’s documentation is version-specific. For this, it is necessary to determine the version of Angular to properly use the correct guides and tutorials.

Troubleshooting: When you encounter a problem, you are able to look at the solutions provided for your version of Angular and get help from the community.

Also Read : How To Use Reactive Forms in Angular?

Conclusion

Learning how to check angular version is very important. It helps you make sure everything works well together, follow the right guides, and fix problems easily. You can check the version using ng version, npm list, or by looking at the package.json file. Each way is simple and gives you the information you need. Always check your Angular version to keep your project running smoothly.

Upcoming Batches For Angular Certification Training Course Online
Course NameDateDetails
Angular Certification Training Course Online

Class Starts on 21st December,2024

21st December

SAT&SUN (Weekend Batch)
View Details
Angular Certification Training Course Online

Class Starts on 15th February,2025

15th February

SAT&SUN (Weekend Batch)
View Details
Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

How to check the angular version?

edureka.co