nvm
nvm copied to clipboard
Default node version is only applied after a system reboot
Operating system and version:
Fedora Linux 42
nvm debug output:
nvm --version: v0.40.3
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'jeffteixeira'
${HOME}: /var/home/jeffteixeira
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v22.19.0/bin:${HOME}/.local/bin:${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.2.37(1)-release (x86_64-redhat-linux-gnu)'
uname -a: 'Linux 6.16.3-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Aug 23 17:02:17 UTC 2025 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Fedora Linux 42.20250829.0 (Silverblue)
awk: /usr/sbin/awk, GNU Awk 5.3.1, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.2, GNU MP 6.3.0)
curl: /usr/sbin/curl, curl 8.11.1 (x86_64-redhat-linux-gnu) libcurl/8.11.1 OpenSSL/3.2.4 zlib/1.3.1.zlib-ng libidn2/2.3.8 nghttp2/1.64.0
wget: /usr/sbin/wget, GNU Wget2 2.2.0 - multithreaded metalink/file/website downloader
git: /usr/sbin/git, git version 2.51.0
ls: cannot access 'alias'$'\n''/usr/sbin/grep': No such file or directory
grep: alias grep='grep --color=auto'
/usr/sbin/grep (grep --color=auto), grep (GNU grep) 3.11
sed: /usr/sbin/sed, sed (GNU sed) 4.9
cut: /usr/sbin/cut, cut (GNU coreutils) 9.6
basename: /usr/sbin/basename, basename (GNU coreutils) 9.6
rm: /usr/sbin/rm, rm (GNU coreutils) 9.6
mkdir: /usr/sbin/mkdir, mkdir (GNU coreutils) 9.6
xargs: /usr/sbin/xargs, xargs (GNU findutils) 4.10.0
nvm current: v22.19.0
which node: ${NVM_DIR}/versions/node/v22.19.0/bin/node
which iojs: which: no iojs in (${NVM_DIR}/versions/node/v22.19.0/bin:${HOME}/.local/bin:${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
which npm: ${NVM_DIR}/versions/node/v22.19.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v22.19.0
npm root -g: ${NVM_DIR}/versions/node/v22.19.0/lib/node_modules
nvm ls output:
v20.19.4
v22.17.0
v22.18.0
-> v22.19.0
default -> lts/* (-> v22.19.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v22.19.0) (default)
stable -> 22.19 (-> v22.19.0) (default)
lts/* -> lts/jod (-> v22.19.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 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.20.8 (-> N/A)
lts/iron -> v20.19.4
lts/jod -> v22.19.0
How did you install nvm?
Install script in readme
What steps did you perform?
Change default node version with nvm alias default <version>.
Close terminal.
Reopen terminal.
Check result of node -v command
What happened?
The default node version is not changed, only after a system reboot.
What did you expect to happen?
The default node version should be applied after closing and reopening the terminal.
Is there anything in any of your profile files that modifies the PATH?
No.
Can you elaborate a bit? Closing and reopening the terminal should do the same thing as a system reboot - re-source the profile files.
Is there any chance that the directory you were in prior to a reboot had a .nvmrc in it or its ancestors?
My default node version is 22.19.0. For example, if I change to 22.18.0 with nvm alias default v22.18.0, close terminal e reopen it, the comand node -v returns v22.19.0. After a system reboot, the command node -v returns v22.18.0. I ran these commands in the home directory.
Can you confirm that there's no ~/.nvmrc file, and there's nothing in .bashrc, .bash_profile, .zshrc, etc that has a node version in it or nvm referenced (except for the 2-3 lines the install script put in)?
Yes, I don't have the ~/.nvrmc file and there's nothing in .bashrc, .bash_profile and .zshrc.
What's the output of nvm debug before a system reboot, vs after? (i assume the one in the OP is one of these two)
Before system reboot
nvm --version: v0.40.3
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'jeffteixeira'
${HOME}: /var/home/jeffteixeira
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/.sdkman/candidates/maven/current/bin:${HOME}/.sdkman/candidates/java/current/bin:${NVM_DIR}/versions/node/v22.19.0/bin:${HOME}/.local/bin:${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:${HOME}/.local/share/JetBrains/Toolbox/scripts
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, versão 5.2.37(1)-release (x86_64-redhat-linux-gnu)'
uname -a: 'Linux 6.16.3-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Aug 23 17:02:17 UTC 2025 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Fedora Linux 42.20250903.0 (Silverblue)
awk: awk está na tabela hash (/usr/sbin/awk), GNU Awk 5.3.1, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.2, GNU MP 6.3.0)
curl: curl é /usr/sbin/curl, curl 8.11.1 (x86_64-redhat-linux-gnu) libcurl/8.11.1 OpenSSL/3.2.4 zlib/1.3.1.zlib-ng libidn2/2.3.8 nghttp2/1.64.0
wget: wget é /usr/sbin/wget, GNU Wget2 2.2.0 - multithreaded metalink/file/website downloader
ls: não foi possível acessar 'git': Arquivo ou diretório inexistente
git: git é /usr/sbin/git, git version 2.51.0
ls: não foi possível acessar 'grep': Arquivo ou diretório inexistente
grep: grep está apelidada para `grep --color=auto', grep (GNU grep) 3.11
ls: não foi possível acessar 'sed': Arquivo ou diretório inexistente
sed: sed é /usr/sbin/sed, sed (GNU sed) 4.9
ls: não foi possível acessar 'cut': Arquivo ou diretório inexistente
cut: cut é /usr/sbin/cut, cut (GNU coreutils) 9.6
ls: não foi possível acessar 'basename': Arquivo ou diretório inexistente
basename: basename é /usr/sbin/basename, basename (GNU coreutils) 9.6
ls: não foi possível acessar 'rm': Arquivo ou diretório inexistente
rm: rm é /usr/sbin/rm, rm (GNU coreutils) 9.6
ls: não foi possível acessar 'mkdir': Arquivo ou diretório inexistente
mkdir: mkdir está na tabela hash (/usr/sbin/mkdir), mkdir (GNU coreutils) 9.6
ls: não foi possível acessar 'xargs': Arquivo ou diretório inexistente
xargs: xargs é /usr/sbin/xargs, xargs (GNU findutils) 4.10.0
nvm current: v22.19.0
which node: ${NVM_DIR}/versions/node/v22.19.0/bin/node
which iojs: which: no iojs in (${HOME}/.sdkman/candidates/maven/current/bin:${HOME}/.sdkman/candidates/java/current/bin:${NVM_DIR}/versions/node/v22.19.0/bin:${HOME}/.local/bin:${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:${HOME}/.local/share/JetBrains/Toolbox/scripts)
which npm: ${NVM_DIR}/versions/node/v22.19.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v22.19.0
npm root -g: ${NVM_DIR}/versions/node/v22.19.0/lib/node_modules
After system reboot
nvm --version: v0.40.3
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'jeffteixeira'
${HOME}: /var/home/jeffteixeira
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/.sdkman/candidates/maven/current/bin:${HOME}/.sdkman/candidates/java/current/bin:${NVM_DIR}/versions/node/v22.18.0/bin:${HOME}/.local/bin:${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:${HOME}/.local/share/JetBrains/Toolbox/scripts
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, versão 5.2.37(1)-release (x86_64-redhat-linux-gnu)'
uname -a: 'Linux 6.16.3-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Aug 23 17:02:17 UTC 2025 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Fedora Linux 42.20250903.0 (Silverblue)
awk: awk está na tabela hash (/usr/sbin/awk), GNU Awk 5.3.1, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.2, GNU MP 6.3.0)
curl: curl é /usr/sbin/curl, curl 8.11.1 (x86_64-redhat-linux-gnu) libcurl/8.11.1 OpenSSL/3.2.4 zlib/1.3.1.zlib-ng libidn2/2.3.8 nghttp2/1.64.0
wget: wget é /usr/sbin/wget, GNU Wget2 2.2.0 - multithreaded metalink/file/website downloader
ls: não foi possível acessar 'git': Arquivo ou diretório inexistente
git: git é /usr/sbin/git, git version 2.51.0
ls: não foi possível acessar 'grep': Arquivo ou diretório inexistente
grep: grep está apelidada para `grep --color=auto', grep (GNU grep) 3.11
ls: não foi possível acessar 'sed': Arquivo ou diretório inexistente
sed: sed é /usr/sbin/sed, sed (GNU sed) 4.9
ls: não foi possível acessar 'cut': Arquivo ou diretório inexistente
cut: cut é /usr/sbin/cut, cut (GNU coreutils) 9.6
ls: não foi possível acessar 'basename': Arquivo ou diretório inexistente
basename: basename é /usr/sbin/basename, basename (GNU coreutils) 9.6
ls: não foi possível acessar 'rm': Arquivo ou diretório inexistente
rm: rm é /usr/sbin/rm, rm (GNU coreutils) 9.6
ls: não foi possível acessar 'mkdir': Arquivo ou diretório inexistente
mkdir: mkdir está na tabela hash (/usr/sbin/mkdir), mkdir (GNU coreutils) 9.6
ls: não foi possível acessar 'xargs': Arquivo ou diretório inexistente
xargs: xargs é /usr/sbin/xargs, xargs (GNU findutils) 4.10.0
nvm current: v22.18.0
which node: ${NVM_DIR}/versions/node/v22.18.0/bin/node
which iojs: which: no iojs in (${HOME}/.sdkman/candidates/maven/current/bin:${HOME}/.sdkman/candidates/java/current/bin:${NVM_DIR}/versions/node/v22.18.0/bin:${HOME}/.local/bin:${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:${HOME}/.local/share/JetBrains/Toolbox/scripts)
which npm: ${NVM_DIR}/versions/node/v22.18.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v22.18.0
npm root -g: ${NVM_DIR}/versions/node/v22.18.0/lib/node_modules
hmm - a system reboot shouldn't be any different from closing and reopening a terminal.
I uninstalled nvm and reinstalled it, but the result was the same.
I do see ls: cannot access 'alias'$'\n''/usr/sbin/grep': No such file or directory in your nvm debug output - that's the only thing that jumps out at me tho.
jeffteixeira@fedora:~$ which grep
alias grep='grep --color=auto'
/usr/sbin/grep
I have grep installed
What information?
I'm a bit at a loss. Closing and reopening your terminal, as far as I'm aware, is the same as rebooting from the shell's perspective.
https://github.com/user-attachments/assets/ecf95d61-2476-4b2d-aa20-a11f7754008a
A short video to demonstrate the problem
Hello! Same behavior here. I cannot set the default version. If I close the Terminal or open another Terminal inside VSCode, the old version continues there.
Steps to Reproduce:
**OPEN Terminal**
node --version
v20.14.0
nvm use 24.6.0
Now using node v24.6.0 (npm v11.5.1)
node --version
v24.6.0
**CLOSE Terminal**
node --version
v20.14.0
@josianni nvm use does not and should not change the default version. Try nvm alias default 24.6.0, for example.
Should be a practical way to go through through the algorithms and the letters and the numbers in the numerals you should be able to figure it out how to balance it into an even