Semantic Versioning

Bautista Aramendía Pradal / December 09, 2021 / 2 min read

reactjavascriptoptimization

Read the Have you ever had your app crashed and didn't know exactly why? section.Have you ever had your app crashed and didn't know exactly why?#

Read the It may have something to do with your dependencies. section.It may have something to do with your dependencies.#

There is something called semantic versioning. But what this means? It means that every number in the version has a semantic meaning: For example, "2.5.7":


-The third number means that some patches or hot-fixes have been made.

-The second number, or "minor", means that some features have been added.

-The first number, or "major", means that the entire version has been updated.


But we often see the versioning with a caret (^): "^2.5.7". This indicates that the version will be uptaded until certain point. Every time we do `npm install`, we will got the latest version of the package (regarding the patches, not the features nor the entire version).

Read the This means that with the caret we don't control what we install. How can we solve it? section.This means that with the caret we don't control what we install. How can we solve it?#

alt of the image

We can solve it by removing the caret from the versioning. Or we could, every single time that we install a package, add the "-E" command: npm install express -E. Thus, we would be installing the exact version of the package.


For keeping a close eye regarding our dependencies, we can install a VSCode extension called "Version Lens". This extension will allow us to control the version of our dependencies, and will tell If it is the latest version. If not, it will indicate us If it is compatible with the current version, and offer us to update to the latest.