| Symbol | Description | Example | Matches |
|---|---|---|---|
^ | Compatible with version (npm caret) | ^1.2.3 | ≥1.2.3 <2.0.0 (for 0.x, only patch) |
~ | Approximately equivalent to version | ~1.2.3 | ≥1.2.3 <1.3.0 |
> >= < <= | Greater/less than comparisons | >=1.0.0 <2.0.0 | 1.0.0 to 1.9.9 |
- | Hyphen range | 1.2.3 - 2.3.4 | ≥1.2.3 ≤2.3.4 |
|| | Logical OR | 1.2.3 || 1.4.5 | Matches either version |
SemVer is a versioning scheme (MAJOR.MINOR.PATCH) where increments signal the type of change: MAJOR for breaking changes, MINOR for new features (backward compatible), PATCH for bug fixes.
For versions below 1.0.0, the SemVer spec considers anything MAY change at any time. npm's caret treats `^0.x.y` as `~0.x.y`, meaning it will only update the patch version.
Versions like `1.0.0-alpha.1` indicate unstable releases. They have lower precedence than the associated normal version (e.g., `1.0.0-alpha` < `1.0.0`).
Compare major, then minor, then patch numerically. If all are equal, a version with a prerelease tag is smaller than one without. Build metadata is ignored.
Use `^` for libraries that follow SemVer strictly (most do). Use `~` if you want only patch updates. For exact versions, just write the version number.
`*` matches any version. `latest` is a tag often used by npm to point to the newest stable release. Our tool supports these as literal strings in range matching.
No, build metadata is ignored when determining version precedence. `1.0.0+2013` and `1.0.0+build.1` are considered equal.