Installing multiple version of Node Js in SLES with Node Version Manager
There may be instances where we may require multiple version of Node Js for different applications. For this kind of situations, Node Version Manager comes as a rescue to manage different versions of Node Js in a single instance of SUSE Linux.
If you are looking for installation of a specific version of Node Js, then check out my other article on installing latest version of Node Js in SLES here.
Installing Node Version Manager (NVM)
Execute the below code without sudo
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
This installs nvm and configures the system. Close and re-open the terminal for the changes to take effect.
Install Different Versions of Node
To install the latest version of Node Js, execute the command nvm install node
. node is the alias name for the latest version of Node Js and this installs the most recent version of node. At this time of writing, the version installed for me is 11.2.0
To install stable version of respective major version, execute the command
nvm install [version number]
The command nvm install 10
installs the stable version of 10, which is 10.13.0
The command nvm install 8
installs the stable version of 8, which is 8.12.0
Manage Node Versions
To view the list of Node Js versions installed via Node Version Manager, execute the command nvm ls
. This lists out all the versions of node that are installed and managed by nvm. This also indicates, which version of node is set as default version of node in that machine.
To set a version of node as the default version of node temporarily for that session, execute the command nvm use 10
(version number of node). Now, node -v
returns the version number as 10.13.0
To persist the default version of Node Js across sessions, execute the command nvm alias default 8
(version number of node).
To remove a node version, execute the command nvm uninstall 10
(version number of node)
Leave a comment