Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to set --lts as default #1217

Closed
metasean opened this issue Sep 2, 2016 · 12 comments
Closed

Option to set --lts as default #1217

metasean opened this issue Sep 2, 2016 · 12 comments

Comments

@metasean
Copy link
Contributor

metasean commented Sep 2, 2016

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?

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

nvm alias default lts/* should do it.

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

@skippednote
Copy link

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.

@ljharb
Copy link
Member

ljharb commented Mar 7, 2017

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

@skippednote
Copy link

@ljharb Oh didn't know. Thanks.

@amyrlam
Copy link

amyrlam commented Dec 6, 2017

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)

@ljharb
Copy link
Member

ljharb commented Dec 6, 2017

@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 #1217 (comment) - so I'm closing this one)

@ljharb ljharb closed this as completed Dec 6, 2017
Velociraptor85 added a commit to Velociraptor85/cloudstorj that referenced this issue Feb 28, 2018
set default nvm version so any further logon will use this like described here nvm-sh/nvm#1217 (comment)

note sure about the escape characters
@friederbluemle
Copy link

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/*'

@callumlocke
Copy link

The solution provided doesn't work any more (using ZSH):

❯ nvm alias default 'lts/*'
! WARNING: Version 'lts/*' does not exist.
default -> lts/* (-> N/A)

❯ nvm use default
N/A: version "default -> N/A" is not yet installed.

You need to run "nvm install default" to install it before using it.

❯ nvm install default
Version 'default' not found - try `nvm ls-remote` to browse available versions.

@ljharb
Copy link
Member

ljharb commented Mar 25, 2022

@callumlocke can you file a new issue for that? that definitely seems like a bug.

@Booli
Copy link

Booli commented Apr 15, 2022

The solution provided doesn't work any more (using ZSH):

❯ nvm alias default 'lts/*'
! WARNING: Version 'lts/*' does not exist.
default -> lts/* (-> N/A)

❯ nvm use default
N/A: version "default -> N/A" is not yet installed.

You need to run "nvm install default" to install it before using it.

❯ nvm install default
Version 'default' not found - try `nvm ls-remote` to browse available versions.

I have the same issue

@robbiemu
Copy link

yes please, this should be reopened. the behavior on the cli is internally inconsistent even if the prescribed solution still did work. I would expect --lts should be accepted by nvm alias

@ljharb
Copy link
Member

ljharb commented Feb 26, 2023

@robbiemu per #1217 (comment), i'm waiting for a new issue to be opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants