To install nvm (Node Version Manager) inside zsh, you can follow these steps:
Open your terminal and navigate to your home directory:
bash
cd ~
Clone the nvm repository from GitHub:
bash
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:
bash
nano ~/.zshrc
Add the following line to the bottom of the file to source nvm:
bash
source ~/.nvm/nvm.sh
Save and exit the file by pressing Ctrl+X, then Y, then Enter.
Restart your terminal or source your .zshrc file:
bash
source ~/.zshrc
Verify that nvm is installed by running the following command:
bash
nvm --version
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:
nvm ls
And to use specific version we can use this command:
nvm use v16.6.0
Thanks
Top comments (5)
Very helpful article @saanchitapaul. This really proved useful when I faced JUST this particular problem using zshell despite logging out or even restarting the system. Very much thankful to you! Keep writing and amazing the community! :)
Saved my time
Time Saved!
Thank U ! Worked out of the box :)
Thanks!