Skip to content
On this page

一般版本号有三个数字组成 x.y.z

  • 第一个数字是主版本;
  • 第二个数字是次版本;
  • 第三个数字是补丁版本。
js
 `^`:只会执行不更改最左边非零数字的更新。 如果写入的是 ^0.13.0,则当运行 npm update 时,
可以更新到 0.13.10.13.2 等,但不能更新到 0.14.0 或更高版本。 如果写入的是 ^1.13.0
则当运行 npm update 时,可以更新到 1.13.11.14.0 等,但不能更新到 2.0.0 或更高版本。
 `~`:如果写入的是 〜0.13.0,则当运行 npm update 时,会更新到补丁版本:即 0.13.1 可以,但 0.14.0 不可以。
 `>`:接受高于指定版本的任何版本。
 `>=`:接受等于或高于指定版本的任何版本。
 `<=`:接受等于或低于指定版本的任何版本。
 `<`:接受低于指定版本的任何版本。
 `=`:接受确切的版本。
 `-`:接受一定范围的版本。例如:2.1.0 - 2.6.2
 `||`:组合集合。例如 < 2.1 || > 2.6
json
"devDependencies": {
    "@babel/core": "^7.19.1",
    "@babel/preset-env": "^7.19.1", 
    "postcss": "^8.4.16", // update -> >= 8.4.16 且 < 9.0.0
    "postcss-loader": "^7.0.1",
    "thread-loader": "^3.0.4",
    "vue-loader": "15.10.0",
    "xxx-loader": "~1.10.1", // update -> >= 1.10.1 且 < 1.11.0
},

Released under the MIT License.