Search code examples
node.jsnvm

Node version manager issue on mac


I am installing nvm on mac using the command

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

After installed I am opening new tab. But I keep getting error zsh: command not found: nvm. Thank you in advance.


Solution

  • For me the issue was I was using bash before and now have zsh which was only inserting the env loading lines in .bashrc. I had to copy the following lines manually into .zshrc.

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

    Check and add these lines if they are not in it already.

    This has been mentioned in the wiki as well.