Search code examples
node.jsmacosnpmnvm

Terminal not recognizing npm and node, installed with nvm (on MAC)


I have installed nodejs and npm using NVM on mac, Whenever i open new terminal, it keep forgetting npm and node. I am using mac

I am facing this error

npm not found

npm -v

I am expecting the npm version from this command


Solution

  • First check if nvm path is added in .zshrc

    Add this to your .zshrc if not already added

    export PATH=$HOME/bin:/usr/local/bin:$PATH
    

    Also load and add path on NVM

        export NVM_DIR="/Users/{USER NAME}/Library/Application {PATH of NVM}"
    
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    

    Then add nvm alias

    nvm alias default stable