You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Host operating system and version: Windows 10 Pro (Version: 21H1) (Build: 19043.1288)
(Windows only) Native Docker or Docker Toolbox: Docker Desktop v4.1.1
Docker version: (Engine) 20.10.8
Docker Compose version: 1.29.2
(Linux) Is SELinux enabled?: no
What git commit hash are you on?: n/a
SUMMARY
when nvm loads it starts with system node despite the default being set to something else. system node coincidentally happens to be the same version as the default/stable version in nvm.
STEPS TO REPRODUCE
# Currently installed node versions. default is stable v16.3
$ nvm ls
v14.17.1
v16.3.0
-> system
default -> node (-> v16.3.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.3.0) (default)
stable -> 16.3 (-> v16.3.0) (default)
lts/* -> lts/fermium (-> v14.17.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.24.1 (-> N/A)
lts/erbium -> v12.22.1 (-> N/A)
lts/fermium -> v14.17.1
# current node in use
$ nvm current
system
# system node version
$ nvm ls system
-> system
# current default node version
$ nvm ls default
v16.3.0
# set default node version to lts v14
$ nvm alias default lts/*
default -> lts/* (-> v14.17.1)
# new default node version
$ nvm ls default
v14.17.1
# use default node
$ nvm use default
Now using node v14.17.1 (npm v6.14.13)
# current node in use (correct)
$ nvm current
v14.17.1
# restart shell
$ exit
logout
PS > .\shell.bat
# current node in use (should be v14)
$ nvm current
system
# check default node (correct)
$ nvm ls default
v14.17.1
$ nvm ls
v14.17.1
v16.3.0
-> system
default -> lts/* (-> v14.17.1)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.3.0) (default)
stable -> 16.3 (-> v16.3.0) (default)
lts/* -> lts/fermium (-> v14.17.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.24.1 (-> N/A)
lts/erbium -> v12.22.1 (-> N/A)
lts/fermium -> v14.17.1
EXPECTED BEHAVIOUR
After setting the default node version, the default node version should be in use upon restarting the shell
ACTUAL BEHAVIOUR
Upon restarting the shell, nvm uses system node rather than the set default
SOLUTION
According to nvm-sh/nvm#1184 (comment) the issue/solution is the ordering of $PATH exports and sourcing of NVM in shell profiles
If you move the below nvm lines found in .bashrc to be after the other $PATH lines, then it resolves the issue.
I have confirmed that the above resolves the issue.
# relevant lines moved to end of .bashrc
$ tail ~/.bashrc
for f in /etc/bashrc-devilbox.d/*.sh ; do
if [ -r "${f}" ]; then
. "${f}"
fi
done
unset f
fi
export NVM_DIR="/opt/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# set default node version
$ nvm alias default lts/*
default -> lts/* (-> v14.17.1)
# confirm new default version
$ nvm ls default
v14.17.1
# current version in use
$ nvm current
system
# use default version
$ nvm use default
Now using node v14.17.1 (npm v6.14.13)
# confirm new default version in use
$ nvm current
v14.17.1
# restart shell
$ exit
logout
PS > .\shell.bat
# confirm version in use is default and not system (correct)
$ nvm current
v14.17.1
The text was updated successfully, but these errors were encountered:
ISSUE TYPE
OS / ENVIRONMENT
SUMMARY
when nvm loads it starts with system node despite the default being set to something else. system node coincidentally happens to be the same version as the default/stable version in nvm.
STEPS TO REPRODUCE
EXPECTED BEHAVIOUR
After setting the default node version, the default node version should be in use upon restarting the shell
ACTUAL BEHAVIOUR
Upon restarting the shell, nvm uses system node rather than the set default
SOLUTION
According to nvm-sh/nvm#1184 (comment) the issue/solution is the ordering of $PATH exports and sourcing of NVM in shell profiles
If you move the below nvm lines found in .bashrc to be after the other $PATH lines, then it resolves the issue.
I have confirmed that the above resolves the issue.
The text was updated successfully, but these errors were encountered: