[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 58 lines 2.5 kB view raw view rendered
1--- 2title: Semver Ranges 3description: Learn how to use semver ranges to filter package versions on npmx.dev 4navigation: 5 icon: i-lucide-filter 6--- 7 8npm uses [semantic versioning](https://semver.org/) (semver) to manage package versions. A **semver range** is a string that describes a set of version numbers. On npmx, you can type a semver range into the version filter input on any package page to quickly find matching versions. 9 10## Version format 11 12Every npm version follows the format **MAJOR.MINOR.PATCH**, for example `3.2.1`: 13 14- **MAJOR** - incremented for breaking changes 15- **MINOR** - incremented for new features (backwards-compatible) 16- **PATCH** - incremented for bug fixes (backwards-compatible) 17 18Some versions also include a **prerelease** tag, such as `4.0.0-beta.1`. 19 20## Common range syntax 21 22| Range | Meaning | Example matches | 23| ---------------- | ------------------------------------------------- | -------------------- | 24| `*` | Any version | 0.0.2, 3.1.0, 3.2.6 | 25| `^3.0.0` | Compatible with 3.x (same major) | 3.0.0, 3.1.0, 3.9.5 | 26| `~3.2.0` | At least 3.2.0, same major.minor | 3.2.0, 3.2.1, 3.2.99 | 27| `3.2.x` | At least 3.2.0, same major.minor | 3.2.0, 3.2.1, 3.2.99 | 28| `>=2.0.0 <3.0.0` | At least 2.0.0 but below 3.0.0 | 2.0.0, 2.5.3, 2.99.0 | 29| `1.2.3` | Exactly this version | 1.2.3 | 30| `=1.2.3` | Exactly this version | 1.2.3 | 31| `^0.3.1` | At least 0.3.1, same major.minor (0.x is special) | 0.3.1, 0.3.2 | 32| `^0.0.4` | Exactly 0.0.4 (0.0.x is special) | 0.0.4 (only) | 33 34## Examples 35 36### Find all 3.x versions 37 38Type `^3.0.0` to see every version compatible with major version 3. 39 40### Find patch releases for a specific minor 41 42Type `~2.4.0` to see only 2.4.x patch releases (2.4.0, 2.4.1, 2.4.2, etc.). 43 44### Find versions in a specific range 45 46Type `>=1.0.0 <2.0.0` to see all 1.x stable releases. 47 48### Find a specific version 49 50Type the exact version number, like `5.3.1`, to check if it exists. 51 52### Find prerelease versions 53 54Type `>=3.0.0-alpha.0` to find alpha, beta, and release candidate versions for a major release. 55 56## Learn more 57 58The full semver range specification is documented at [node-semver](https://github.com/npm/node-semver#ranges).