Linux Hint Posted July 11, 2023 Share Posted July 11, 2023 The zsh command not found: nvm error is a common issue when attempting to use the nvm command within the Zsh shell, but the shell cannot find it in its list of recognized commands. This error prevents you from managing Node.js versions and executing nvm-related commands. Possible Reasons for the Zsh Command not found: nvm Error Several reasons can lead to the zsh command not found: nvm error on your Mac, including: 1: Missing or Inaccessible nvm Installation The error occurs if nvm is not installed on the system or if it is not accessible within the Zsh shell. 2: Incorrect PATH Configuration Suppose the directory containing the nvm executable is not included in the PATH environment variable. In that case, the shell won’t be able to locate and execute the nvm command, resulting in the command not found error. Solution to Fix zsh: command not found: nvm error on Mac To fix the zsh: command not found: nvm error, follow the below-given steps: Step 1: Install nvm Begin by installing nvm on your Mac from Homebrew with the following command: brew install nvm Note: To perform the above step you must have Homebrew installed on your Mac. Find a complete guide for Intel and Apple Silicon-based Macs here. Step 2: Check for the Installed Package You need to determine the installation path or directory of the nvm package managed by Homebrew using the following command. brew --prefix nvm Step 3: Open Zsh Configuration File Now open the zshrc configuration file using the nano editor via the command given below: sudo nano /etc/zshrc Add the following line at the end of the zshrc file: export NVM_DIR="$HOME/.nvm" . "/usr/local/opt/nvm/nvm.sh"\ Step 4: Save the Configuration File Once you made the necessary changes to the file, you have to save it using CTRL+X, add Y and press Enter. source /etc/zshrc Step 5: Test the Installation To test whether the changes are successfully applied, you must run the version command again. nvm --version If the command executes without any errors and displays the version information, it indicates that the changes to nvm have been applied correctly. Conclusion Encountering the zsh command not found: nvm error in the Zsh shell on Mac can be frustrating, as it prevents you from using nvm and managing Node.js versions effectively. The error is commonly caused by missing nvm installation and incorrect PATH configuration. By following the provided solutions, including installing nvm, updating the zshrc configuration file, and testing the installation with the nvm –version command, you can resolve the error and successfully use nvm in your Zsh shell on Mac. View the full article Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.