when nvm (Node Version Manager) is used by Mac users, they may come across the zsh command not found nvm error. It happens when for zsh shell the nvm command could not be located in any of your PATH environment variable directories. Fortunately, there are some steps you can do to fix this problem and make sure that your Mac runs well with nvm. In this tutorial we will attempt to resolve zsh command not found nvm issue on your Mac. If you are a MacOS user who is into virtual servers then it is advisable that you opt for any type of VPS server depending on what you want and pay through Perfect Money or digital currencies.
Table of Contents
Step 1: Check the Installation of NVM
Before starting on any troubleshooting steps, it is important to confirm that nvm has been installed correctly. Open the a terminal window and type in the following command:
nvm --version
At this point you should see the version number.
If not, then you will have to download nvm using one of these commands for your system from homebrew:
brew install nvm
Step 2: Edit .zshrc File
The next step is to edit the .zshrc file, which is the configuration file for the zsh shell. Open the a terminal and enter the command:
sudo nano /etc/zshrc
Look for any lines related to nvm and ensure they are uncommented (remove any preceding hashes ‘#’ if present). The relevant lines may look like to be this:
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"\
Save the changes to the .zshrc file by pressing CTRL+X, followed by Y, and then Enter.
Step 3: Save the .zshrc File
After alteration of .zshrc file, it should be saved to reflect the modifications made. In a terminal type the following command:
source /etc/zshrc
This will result in reloading of .zshrc and updating of shell with the changed settings.
Step 4: Verify NVM Installation
To ascertain whether or not the problem is fixed, reissue the nvm command like this:
nvm --version
If zsh command not found nvm error does not appear anymore and it outputs version number, congratulations – you have successfully solved this issue.
Conclusion
However, the “zsh: command not found: nvm” error can be really annoying. It is not a big deal to dealing with this issue on your Mac if you stick to the steps provided in this article. Checking out nvm installation process, amending the .zshrc file by including necessary configurations and saving it for changes update will all enable you have nvm working properly without “command not found” errors. Thus, once nvm works fine, you can easily change various Node.js versions on MacOS as per your needs for development purposes.