Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_components/VersionSpecifierTable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
| Latest alpha | `alpha` | Newest release whose version contains `-alpha`. Keeps the full prerelease tag for download. |
| Latest LTS | `lts` | Newest available LTS release. |
| Named LTS line | `lts/iron` | Newest release from the named LTS line. |
| Previous LTS line(s) | `lts/-1`, `lts/-2` | Nth previous unique LTS line (newest first). Same meaning as unix `nvm`. |
| User alias | `legacy` | Version assigned with [`nvm alias add`](../command/nvm/alias/add). |
| Major only | `24` | Newest matching `24.x.x` release. |
| Major.minor | `24.1` | Newest matching `24.1.x` release. |
Expand Down
2 changes: 1 addition & 1 deletion docs/cfg/aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ next -> v24.11.0
| `alpha` | Built-in: newest `-alpha*` catalog release |
| `daily`, `beta`, `prerelease` | Reserved for future use |
| `link`, `shim` | Operating mode names |
| `lts/*` (for example `lts/iron`) | Reserved LTS namespace |
| `lts/*` (for example `lts/iron`, `lts/-1`) | Reserved LTS namespace (codenames and `lts/-N` offsets are built-in) |

Pick names like `legacy`, `apps`, `ci`, or `stable24` instead.

Expand Down
2 changes: 1 addition & 1 deletion docs/command/nvm/alias/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Usage: nvm alias <command>
| `default`, `current`, `latest`, `lts`, `last` | Built-in command semantics |
| `daily`, `alpha`, `beta`, `prerelease` | Reserved for future use |
| `link`, `shim` | Operating mode names |
| `lts/*` | Reserved LTS namespace (for example `lts/iron`) |
| `lts/*` | Reserved LTS namespace (for example `lts/iron`, `lts/-1`) |

## Notes

Expand Down
1 change: 1 addition & 0 deletions docs/command/nvm/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ nvm install alpha
nvm install 24
nvm install 22.14.0 20.19.1
nvm install lts/iron
nvm install lts/-1
nvm install 24 --cache
nvm install 24 --no-cache
nvm install 24.0.0 --force
Expand Down
2 changes: 1 addition & 1 deletion docs/features/all-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ See [What's new in v2](./newv2) for a shorter v2 summary.

| Feature | Description |
|:-|:-|
| [Install](../command/nvm/install/) | Install one or more Node.js versions. Specs include `latest`, `lts`, `lts/<codename>`, and `x.x.x`. |
| [Install](../command/nvm/install/) | Install one or more Node.js versions. Specs include `latest`, `lts`, `lts/<codename>`, `lts/-N`, and `x.x.x`. |
| Parallel installations | Each requested version installs in its own goroutine. |
| Compact `.7z` archives | Downloads are Windows `.7z` archives (x64 or arm64). Size is about 40% smaller than the old layout. |
| Native extraction | NVM uses installed 7-Zip when present. Otherwise it uses the embedded extractor. |
Expand Down
18 changes: 17 additions & 1 deletion docs/guide/version-resolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ nvm install alpha
# named LTS line
nvm install lts/iron

# previous LTS lines (offset from current LTS)
nvm install lts/-1
nvm use lts/-2

# partial and exact versions
nvm use 24.1
nvm cache add 22.14.0
Expand All @@ -63,6 +67,18 @@ nvm alias add stable 24.1.0
nvm use stable
```

### LTS offsets (`lts/-N`)

`lts/-N` selects the Nth previous LTS **line** relative to the current latest LTS (`lts`). Catalog order is newest first. Unique LTS codenames form the line list; `lts/-1` is the second line, `lts/-2` the third, and so on. `N` must be a positive integer (`lts/-0` is invalid).

Any name under `lts/` that starts with `-` is offset syntax only. It is never treated as a codename.

| Input | Result |
|-------|--------|
| `lts/-1` | Previous LTS line’s newest release |
| `lts/-0`, `lts/-`, `lts/-1x`, `lts/--1` | Error: invalid LTS offset (use `lts/-N` with a positive integer) |
| `lts/-99` when fewer lines exist | Error: LTS offset out of range |

## Version constraints

Version constraints describe acceptable releases in project pinning and
Expand Down Expand Up @@ -97,7 +113,7 @@ Example: default `13.14.0`, `engines.node` is `>=20`. `13.14.0` does not satisfy
## Resolution order {/* #resolution-order */}

1. User alias mapping (from `nvm alias add`)
2. Reserved aliases (`latest`, `alpha`, `lts`, `lts/<codename>`)
2. Reserved aliases (`latest`, `alpha`, `lts`, `lts/<codename>`, `lts/-N`)
3. Partial versions expanded to the best matching concrete release
4. Semver constraints resolved in constraint-aware flows (for example `engines.node` or caret/tilde ranges in detect files)
5. Read version string from the configured detect file in the current directory tree (auto-detect)
Expand Down
Loading