DEV Community

Darshan Raval
Darshan Raval

Posted on

Letz Understand NPM Versioning: A Beginner's Guide

Introduction

In This Blog, We will understand more about the versioning of npm packages or any application.

yes image

[ Hello Buddies ]

Let's get started...

Now, Let's take an example of one npm package called "express".

versioning of npm

We have an npm called "express" and its version is "^4.19.2".
Now, let's break down that version with the use of dot(.) and understand each part individually.

"^4.19.2"
Enter fullscreen mode Exit fullscreen mode
  1. First Part = 4
  2. Second Part = 19
  3. Third Part = 2

The first part we can call a major part of the version.

1 - First Part > [ MAJOR ] = [ 4 ]

If in the future, "4" will become "5" it means that a major update will be there which might break the backward compatibility.

2 - Second Part > [ MINOR ] = [ 19 ]

It means that, if the current version is "19" and it will be 20 or more then it will have some minor fixes and it's recommended to update to the new version.

3 - Third Part > [ PATCH ] = [ 2 ]

It means that, if the current version is "2" and it will be 3 or more then it means that some small bug fixed will be there which will not affect any functionality and it's optional also so if we need to update then update it or it'll not affect anything.

Now, Let's understand the what is the meaning of "^" symbol in the version.

The caret (^) symbol means that it will accept only minor and patch updates. If there is a change in the MAJOR version, it will not accept it.

thanks minions

Thanks!!

Top comments (4)

Collapse
 
satashi0123 profile image
Phuc Nguyen

Thank you, really simple and easy to understand !

Collapse
 
darshanraval profile image
Darshan Raval

Thank you for your appreciation :)

Collapse
 
ayushh profile image
Ayush Sharma

Really, it's very easy to understand.

Collapse
 
darshanraval profile image
Darshan Raval

Thank you for your appreciation buddy :)