Nodejs NPM Module Version number mode parsing

Source: Internet
Author: User

The module versions in NPM are subject to the semantic version rules of Semver 2.0.

Version format: Major version number. The minor version number. Revision number, the version number is incremented as follows: Major version number: When you make incompatible API modifications, the minor version number: When you do a backwards-compatible functionality added, revision number: When you do a backward-compatible problem fix. The prior version number and version compilation information can be added to the "major version number." Minor version number. The revision number is followed by an extension.

Then, based on the semantic version, we can control the dependency versioning when we select the version:

Dependencies: {"Express": "3.x", "Debug": "*", "express-session": "~1.0.0", "Connect-redis": "1.2.3"}
As you can see from the example, there are a number of styles for choosing a version range, which can be seen in the semver in NPM for each of the different styles. and in node. JS's module management, the most commonly used are:

*: Any version
1.1.0: Specify version
~1.1.0: >=1.1.0 && < 1.2.0
^1.1.0: >=1.1.0 && < 2.0.0
where ~ and ^ Two prefixes are confusing, simply put:

The ~ prefix indicates that the installation is larger than the specified version and matches the latest version of Z in x.y.z.
^ prefixes behave the same as ~0.y.z in ^0.y.z, but when ^1.y.z, they are matched to the newest versions of Y and Z.
Specifically, when the version number is ^0.0.Z or ~0.0.z, consider that 0.0.z is an unstable version, so they are equivalent to =0.0.z.

Nodejs NPM Module Version number mode parsing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.