A bug has cropped up in the project recently, but the code for this module has not moved for several months. After investigation, it was found that the local normal production environment was abnormal, which was not caused by code problems. Finally, it was found that the cause was not downward compatibility after the update of the dependent library version. After checkdataThe problem is that the dependency library version range will change according to our configuration!

We can see from the data

1.’~’ allows patch level changes if a minor version is specified. If you do not specify a minor version, minor level changes are allowed

1.2.3 ≤ 1.3.0 to 1.2 ≤ 1.2.0 ≤ 1.3.0 to 1 ≤ 1.0.0 ≤ 2.0.0 to 0.2.3 ≤ 0.3.0 to 0.2 The value is greater than or equal to 0.2.0 and less than 0.3.0 to 0. The value is greater than or equal to 0.0.0 and less than 1.0.0Copy the code

2.’^’ allows changes to be made without modification[Major version, Minor version, patch version]The leftmost non-zero version of a tuple

^1.2.3: greater than or equal to 1.2.3: less than 2.0.0-0 ^0.2.3: greater than or equal to 0.2.3: less than 0.3.0-0 ^0.0.3: greater than or equal to 0.0.4-0Copy the code

3. Remove the range symbol

1.2.3 Indicates the fixed value of 1.2.3Copy the code

The current package. Json

Modified package.json

So we fixed the version number of the dependent library, dropped the ‘^’ and committed the code, and the production environment packaged the problem