To install Node Version Manager (NVM) on Ubuntu, you can follow these steps:
-
Open a terminal on your Ubuntu system.
-
Update your package list to ensure you have the latest information about available packages:
sudo apt update
- Install the required dependencies:
sudo apt install curl
- Download and install NVM using curl. The command below will download the install script and execute it:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
- Close and reopen the terminal, or run the following command to load NVM without having to restart the terminal:
source ~/.bashrc
- To verify that NVM has been installed, you can run:
nvm --version
- Now you have NVM installed on your Ubuntu system. You can use NVM to install and manage different versions of Node.js. For example, to install the latest LTS version of Node.js, you can run:
nvm install --lts
And to use a specific version of Node.js, you can set it as the default:
nvm use [version]
Replace [version] with the version number you want to use.
-
Remember that after you've installed NVM, you can always check its documentation for more information on usage and commands:
nvm --help