What does “^” mean in package.json versioning?

Quoting from isaacs/node-semver:

  • ^1.2.3 := >=1.2.3-0 <2.0.0-0 “Compatible with 1.2.3”. When using caret operators, anything from the specified version (including prerelease) will be supported up to, but not including, the next major version (or its prereleases). 1.5.1 will satisfy ^1.2.3, while 1.2.2 and 2.0.0-beta will not.
  • ^0.1.3 := >=0.1.3-0 <0.2.0-0 “Compatible with 0.1.3”. 0.x.x versions are special: the first non-zero component indicates potentially breaking changes, meaning the caret operator matches any version with the same first non-zero component starting at the specified version.
  • ^0.0.2 := =0.0.2 “Only the version 0.0.2 is considered compatible”

That said, I would recommend to use “~” instead because it has more intuitive semantics, see discussion in npm/npm#4587.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)