To install nvm (Node Version Manager) inside zsh, you can follow these steps:
Open your terminal and navigate to your home directory:
Clone the nvm repository from GitHub:
git clone https://github.com/nvm-sh/nvm.git .nvm This will create a hidden directory named .nvm in your home directory.
Open your zsh configuration file:
Add the following line to the bottom of the file to source nvm:
Save and exit the file by pressing Ctrl+X, then Y, then Enter.
Restart your terminal or source your .zshrc file:
Verify that nvm is installed by running the following command:
You should see the version number of nvm printed to the console.
Now you can use nvm to install and manage different versions of Node.js on your system.
Now you can install your desired version like :
nvm install v16.6.0
Now globally it's using v16.6.0
To check list of nvm we can use:
And to use specific version we can use this command:
nvm use v16.6.0