How can the default node version be set using NVM?
I have installed nvm (ubuntu with zsh shell) with two node version: v6.11.5
and v9.0.0
and the default version in nvm is the v9.0.0
Every time I need to change the node version
$ nvm list
v6.11.5
-> v9.0.0
system
default -> node (-> v9.0.0)
node -> stable (-> v9.0.0) (default)
stable -> 9.0 (-> v9.0.0) (default)
$ nvm v6
How could I change the nvm version default to define v6.11.5
?
Solution 1:
(nvm maintainer here)
nvm alias default 6.11.5
if you want it pegged to that specific version.
You can also do nvm alias default 16
.
Either way, you'll want to upgrade to the latest version of nvm
(v0.33.11 as of this writing)
Solution 2:
Lets say to want to make default version as 10.19.0.
nvm alias default v10.19.0
But it will give following error
! WARNING: Version 'v10.19.0' does not exist.
default -> v10.19.0 (-> N/A)
In That case you need to run two commands in the following order
# Install the version that you would like
nvm install 10.19.0
# Set 10.19.0 (or another version) as default
nvm alias default 10.19.0
Solution 3:
This will set the default to be the most current version of node
nvm alias default node
and then you'll need to run
nvm use default
or exit and open a new tab
Solution 4:
If you want to switch only for once use this
nvm use 12.x
Else if you want to switch the default node version then use
nvm use default 12.x or nvm alias default 12.x