[New] nvm alias: store --lts and --lts=<name>

`nvm alias default --lts node` writes `--lts node` to the alias file,
so it resolves to the latest installed LTS version, using each version's recorded LTS status;
`--lts=<name>` limits it to one LTS line.
The flags of the outermost alias apply when one alias points at another,
an alias with a flag this version of nvm doesn't recognize resolves to nothing, rather than ignoring the flag,
and `nvm uninstall` also removes aliases with flags that point at the uninstalled version.
A new shell never downloads index.tab, so it explains a default alias that needs LTS status that isn't recorded yet.
This commit is contained in:
Jordan Harband committed 2026-10-21 12:57:19 -07:00
1 parent e5f1288b40
commit fe2900d176
5 files changed
+253 -14

No files matched your search

+4
View File
@@ -635,8 +635,12 @@ To set a default Node version to be used in any new shell, use the alias 'defaul
nvm alias default node # this refers to the latest installed version of node
nvm alias default 18 # this refers to the latest installed v18.x version of node
nvm alias default 18.12 # this refers to the latest installed v18.12.x version of node
nvm alias default --lts node # this refers to the latest installed LTS version of node
nvm alias default --lts=iron 20 # this refers to the latest installed v20.x version of node from the "iron" LTS line
```
nvm records the LTS status of every version each time it downloads the list of available versions, so `--lts` aliases know which installed versions are LTS.
### Use a mirror of node binaries
To use a mirror of the node binaries, set `$NVM_NODEJS_ORG_MIRROR`: