how to install nvm on ubuntu?

To install nvm (Node Version Manager) on Ubuntu, you can follow these steps:

Clone the nvm repository:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash

Add the following line to your .bashrc or .zshrc file:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

Reload your shell:

source ~/.bashrc   # or source ~/.zshrc

Verify the installation by checking the version:

nvm --version

Now you can install and switch between different Node.js versions using nvm.

Leave a Comment