Skip to content

uppercase in .nvmrc are handled differently for use and install commands #3417

@thomasfromont-adeo

Description

@thomasfromont-adeo

Operating system and version:

Linux (archlinux)

nvm debug output:

nvm --version: v0.40.1
$SHELL: /bin/zsh
$SHLVL: 2
whoami: 'tfromont'
${HOME}: /home/tfromont
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v18.20.4/bin:${HOME}/.cargo/bin:${HOME}/.local/bin:/opt/google-cloud-cli/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.9 (x86_64-pc-linux-gnu)'
uname -a: 'Linux 6.10.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 19 Aug 2024 17:02:39 +0000 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Arch Linux  ()
awk: /usr/bin/awk, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)
curl: /usr/bin/curl, curl 8.9.1 (x86_64-pc-linux-gnu) libcurl/8.9.1 OpenSSL/3.3.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.63.0 nghttp3/1.5.0
wget: /usr/bin/wget, GNU Wget 1.24.5 compilé sur linux-gnu.
git: /usr/bin/git, git version 2.46.0
ls: impossible d'accéder à 'grep:': Aucun fichier ou dossier de ce nom
grep: grep: aliased to grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}), grep (GNU grep) 3.11
sed: /usr/bin/sed, sed (GNU sed) 4.9
cut: /usr/bin/cut, cut (GNU coreutils) 9.5
basename: /usr/bin/basename, basename (GNU coreutils) 9.5
rm: /usr/bin/rm, rm (GNU coreutils) 9.5
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 9.5
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.10.0
nvm current: v18.20.4
which node: ${NVM_DIR}/versions/node/v18.20.4/bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v18.20.4/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v18.20.4
npm root -g: ${NVM_DIR}/versions/node/v18.20.4/lib/node_modules

nvm ls output:

       v14.21.3
->     v18.20.4
       v20.17.0
        v22.6.0
         system
default -> lts/hydrogen (-> v18.20.4)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v22.6.0) (default)
stable -> 22.6 (-> v22.6.0) (default)
lts/* -> lts/iron (-> v20.17.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.20.4
lts/iron -> v20.17.0

How did you install nvm?

Archlinux AUR (community package registry) using an AUR helper (yay in my case`

What steps did you perform?

  • default node version is set to node v18
  • a project have a .nvmrc file which contains the following lts/Iron
  • Go to that project and run nvm use

What happened?

  • nvm use commands output an error telling "lts/Iron" is not yet installed

but a corresponding v20 node is already installed, but still running nvm install to be sure

  • nvm install finds the corresponding installed version, and use it

What did you expect to happen?

Expected the nvm use to find the already installed version, like nvm install did, and use it.

To be fair, the workaround is simply to fix the uppercase in the .nvmrc file (from lts/Iron to lts/iron), I just wanted to create the issue if other stumble accross the same behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions