Nvm: ls-remote erroneously shows any LTS releases as "Latest LTS"

Created on 21 Feb 2020  ·  3Comments  ·  Source: nvm-sh/nvm

Operating system and version:

macOS 10.14.6

nvm debug output:

nvm --version: v0.35.2
$TERM_PROGRAM: iTerm.app
$SHELL: zsh
$SHLVL: 1
${HOME}: /Users/username
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v12.16.1/bin:/usr/local/bin:/usr/local/sbin:${HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/usr/local/munki
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.7.1 (x86_64-apple-darwin18.2.0)'
uname -a: 'Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64'
OS version: Mac 10.14.6 18G103
curl: /usr/bin/curl, curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/bin/wget
  Reason: image not found
wget: /usr/local/bin/wget,
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: rm: aliased to rm -i (rm -i)
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/local/bin/git, git version 2.23.0
ls: grep:: No such file or directory
grep: grep: aliased to grep  --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}), grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20070501
nvm current: v12.16.1
which node: ${NVM_DIR}/versions/node/v12.16.1/bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v12.16.1/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v12.16.1
npm root -g: ${NVM_DIR}/versions/node/v12.16.1/lib/node_modules

nvm ls output:

       v10.15.1
       v12.13.0
       v12.15.0
->     v12.16.1
default -> lts/erbium (-> v12.16.1)
node -> stable (-> v12.16.1) (default)
stable -> 12.16 (-> v12.16.1) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/erbium (-> v12.16.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.19.0 (-> N/A)
lts/erbium -> v12.16.1

How did you install nvm?

install script in readme (cURL)

What steps did you perform?

I tried to verify which version of lts/erbium was considered Latest LTS:

nvm ls-remote v12.13.0
nvm ls-remote v12.15.0
nvm ls-remote v12.16.0
nvm ls-remote v12.16.1

What happened?

ALL responded suggesting they were Latest LTS: Erbium

v12.13.0 (Latest LTS: Erbium)
v12.15.0 (Latest LTS: Erbium)
v12.16.0 (Latest LTS: Erbium)
v12.16.1 (Latest LTS: Erbium)

What did you expect to happen?

Only the _actual_ latest LTS (v12.16.1) should return Latest LTS: Erbium, the others should return as LTS: Erbium (e.g. mimic nvm ls-remote output when no version parameter is passed)

v12.13.0 (LTS: Erbium)
v12.13.1 (LTS: Erbium)
v12.14.0 (LTS: Erbium)
v12.14.1 (LTS: Erbium)
v12.15.0 (LTS: Erbium)
v12.16.0 (LTS: Erbium)
v12.16.1 (Latest LTS: Erbium)

NOTE: This is not limited to just v12.x, I was able to reproduce with v10.x variants as well.

Is there anything in any of your profile files that modifies the PATH?


.zshrc, however was able to reproduce on multiple different machines where this was not a factor.

bugs

All 3 comments

You're right; nvm ls-remote 12 works, but nvm ls-remote 12.13 shows the behavior you see. I guess I never pass anything to it but a major :-p

This would need some awk magic here: https://github.com/nvm-sh/nvm/blob/master/nvm.sh#L1243-L1247

where it marks the last one as "latest" (perhaps with an asterisk), instead of where it currently does it here: https://github.com/nvm-sh/nvm/blob/master/nvm.sh#L1444 (which would then instead need to convert the asterisk to the current prose)

Thanks Jordan!

Was this page helpful?
0 / 5 - 0 ratings