Skip to content

Show the version for "system" in nvm ls#1287

Merged
ljharb merged 1 commit intonvm-sh:masterfrom
PeterDaveHello:show-system-version
Jan 28, 2026
Merged

Show the version for "system" in nvm ls#1287
ljharb merged 1 commit intonvm-sh:masterfrom
PeterDaveHello:show-system-version

Conversation

@PeterDaveHello
Copy link
Collaborator

Show the actual version from "system" for nvm ls

before:

$ nvm ls
         v4.6.1
        v5.12.0
         v6.9.1
->       v7.0.0
         system
xxx -> 5 (-> v5.12.0)
node -> stable (-> v7.0.0) (default)
stable -> 7.0 (-> v7.0.0) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> v6.9.1)
lts/argon -> v4.6.1
lts/boron -> v6.9.1

after:

$ nvm ls
         v4.6.1
        v5.12.0
         v6.9.1
->       v7.0.0
         system (-> v4.2.6)
xxx -> 5 (-> v5.12.0)
node -> stable (-> v7.0.0) (default)
stable -> 7.0 (-> v7.0.0) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> v6.9.1)
lts/argon -> v4.6.1
lts/boron -> v6.9.1

@PeterDaveHello
Copy link
Collaborator Author

wow ... the build failed error message is soooo long lol ...

@ljharb
Copy link
Member

ljharb commented Nov 6, 2016

The reason I never displayed the system version before is because I didn't want anyone to do nvm use 4.2.6 and have it ever activate the system version. This follows rvm and rbenv's behavior as well.

@PeterDaveHello
Copy link
Collaborator Author

@ljharb do you mean to prevent confusion about the version managed by nvm and system? I thought this display is very useful so that I don't need to do nvm use system && node --version to check out the node version of system level, what do you think?

@ljharb
Copy link
Member

ljharb commented Nov 6, 2016

Yes, to prevent that confusion, exactly.

What's the use case for checking the system version more than once in a while?

@ljharb
Copy link
Member

ljharb commented Nov 6, 2016

(also, nvm run system --version)

@PeterDaveHello
Copy link
Collaborator Author

As I have more than one development environments, which may including FreeBSD, Ubuntu 14.04, Ubuntu 16.04, Debian 7, Debian 8, etc, they all have their own but different nodejs versions, and when I want to use a certain version of nodejs, I will use nvm ls to show all the found nodejs versions and see if there is one version I wanted, if the system level got what' I want, I may not need to install it again, that's my point, hope my English is not bad enough to make you confused 😄 Thanks!

About the confusion, maybe use system (v4.2.6) without the arrow to make it different, is this acceptable?

@ljharb
Copy link
Member

ljharb commented Nov 6, 2016

The arrow isn't the thing I'm worried about, it's the version number.

Even if a certain version is installed on the system, you generally would want to install it again so that nvm can manage it. Generally speaking the system version is totally ignored - you're either in "system" mode, or "nvm" mode.

@PeterDaveHello
Copy link
Collaborator Author

Not sure if this my personal scenario only, but sometimes I just want to test if a certain version could work with the certain project, I don't really need it to be managed by nvm, what about add notes with the output like Latest LTS does?

@ljharb
Copy link
Member

ljharb commented Nov 6, 2016

I'm fine with adding helpful output next to "system" - but anything that looks like a version number seems like it could dangerously cause confusion.

@PeterDaveHello
Copy link
Collaborator Author

hmmmm ... then need to think about the how to display since what I want is the version number which is you don't want, haha.

@ljharb
Copy link
Member

ljharb commented Nov 6, 2016

Whatever you come up with, citing examples of other version managers (like rvm, rbenv, virtualenv, etc) and if/how they display the system version would help.

@PeterDaveHello
Copy link
Collaborator Author

I have not test rvm or the other version managers yet, but come up with system-v4.2.6.

@ljharb
Copy link
Member

ljharb commented Aug 22, 2023

@PeterDaveHello would you mind rebasing this?

@ljharb ljharb marked this pull request as draft August 22, 2023 03:57
@PeterDaveHello
Copy link
Collaborator Author

Looks like it needs a rewrite, will take some time, a simple rebase doesn't look so good to resolve the conflict.

@ljharb
Copy link
Member

ljharb commented Aug 22, 2023

that's what i was worried about; the changes to use awk in a bunch of places may have complicated this. it'd be great to update the PR with a rewritten approach, though :-)

@ljharb ljharb force-pushed the master branch 2 times, most recently from c6cfc3a to c20db2a Compare June 10, 2024 18:13
@PeterDaveHello PeterDaveHello force-pushed the show-system-version branch 2 times, most recently from 444f885 to cefd4b0 Compare August 31, 2025 09:58
@PeterDaveHello PeterDaveHello marked this pull request as ready for review August 31, 2025 10:43
@PeterDaveHello
Copy link
Collaborator Author

@ljharb, with some help from GPT-5, the PR has been updated.

@ljharb ljharb force-pushed the show-system-version branch from cefd4b0 to 50bed46 Compare January 20, 2026 22:53
@ljharb
Copy link
Member

ljharb commented Jan 20, 2026

This looks great, but it will need some tests :-)

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Jan 20, 2026
@ljharb ljharb marked this pull request as draft January 20, 2026 22:53
Normalize `nvm_version` output when `nvm_ls` returns "system vX" so alias and .nvmrc resolutions treat system correctly.

Add fast tests for system alias behavior in `nvm ls`, `nvm use`, and `nvm which`.
@PeterDaveHello PeterDaveHello marked this pull request as ready for review January 25, 2026 17:30
@PeterDaveHello
Copy link
Collaborator Author

@ljharb, please take a look.

@ljharb ljharb force-pushed the show-system-version branch from 568a463 to 29a652f Compare January 28, 2026 01:36
@ljharb ljharb merged commit 29a652f into nvm-sh:master Jan 28, 2026
213 of 217 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature requests I want a new feature in nvm! needs followup We need some info or action from whoever filed this issue/PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants