Skip to content

Commit 58afdcc

Browse files
Max Blackowlstronaut
authored andcommitted
docs(install): clarify prerelease version range behavior
1 parent 9f818e8 commit 58afdcc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/lib/content/commands/npm-install.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ Even if you never publish your package, you can still get a lot of benefits of u
200200
npm install @myorg/privatepackage@"16 - 17"
201201
```
202202
203+
**Prerelease versions:** By default, version ranges only match stable versions. To include prerelease versions, they must be explicitly specified in the range. Prerelease versions are tied to a specific version triple (major.minor.patch). For example, `^1.2.3-beta.1` will only match prereleases for `1.2.x`, not `1.3.x`. To match all prereleases for a major version, use a range like `^1.0.0-0`, which will include all `1.x.x` prereleases.
204+
205+
Example:
206+
207+
```bash
208+
npm install package@^1.2.3-beta.1 # Matches 1.2.3-beta.1, 1.2.3-beta.2, 1.2.4-beta.1, etc.
209+
npm install package@^1.0.0-0 # Matches all 1.x.x prereleases and stable versions
210+
```
211+
203212
* `npm install <git remote url>`:
204213
205214
Installs the package from the hosted git provider, cloning it with `git`.

0 commit comments

Comments
 (0)