Nvm: Option to set --lts as default

Created on 2 Sep 2016  路  7Comments  路  Source: nvm-sh/nvm

To install the latest long term support version the command is:

nvm install --lts

If I do a fresh install, then close and reopen my terminal then run: nvm version
I get: none

To set a default Node version to be used in any new shell, use the alias 'default':

nvm alias default node

But if I run: nvm alias default --lts, nvm alias default lts/*, or nvm alias default lts then I get Unsupported option "--lts"., default -> lts/* (-> N/A), & default -> lts (-> N/A) respectively.

How do I set the LTS version to be the default version?

Most helpful comment

Old issue, but I just ended up here through a Google search. For reference:

On zsh/fish shell, you need to:

nvm install 'lts/*'

nvm alias default 'lts/*'

All 7 comments

nvm alias default lts/* should do it.

The usability of this should be slightly increased by #1204.

On running nvm alias default lts/* I get the following error

No matches for wildcard 'lts/*'.  (Tip: empty matches are allowed in 'set', 'count', 'for'.)
fish: nvm alias default lts/*
                        ^

I'm using fish shell with omf nvm plugin.

@skippednote nvm doesn't support the fish shell, but because many shells might expand the *, try nvm alias default 'lts/*'?

@ljharb Oh didn't know. Thanks.

I have a similar problem. Any ideas how to fix?

My .nvmrc is lts/*.

alam@tesla Tango (amy/nvmrc-lts) $ nvm install --lts
Installing latest LTS version.
v8.9.2 is already installed.
Now using node v8.9.2 (npm v5.5.1)
alam@tesla Tango (amy/nvmrc-lts) $ nvm use
Found '/Users/alam/src/Tango/.nvmrc' with version <lts/*>
N/A: version "N/A" is not yet installed.

You need to run "nvm install N/A" to install it before using it.
alam@tesla Tango (amy/nvmrc-lts) $ nvm alias default lts/*
! WARNING: Version 'lts/*' does not exist.
default -> lts/* (-> N/A)

@amyrlam what shell are you using? (what does nvm debug print out?) What's nvm ls print out?

Would you mind filing a separate issue? (since this is for the feature request, which was addressed by #1204 and https://github.com/creationix/nvm/issues/1217#issuecomment-244415486 - so I'm closing this one)

Old issue, but I just ended up here through a Google search. For reference:

On zsh/fish shell, you need to:

nvm install 'lts/*'

nvm alias default 'lts/*'
Was this page helpful?
0 / 5 - 0 ratings