nvm not properly setting up node for new shell

45 Views Asked by At

I installed nvm (node version manager) on my new M1 Max MacStudio via Homebrew. I'm not sure what I'm doing wrong, but if I start a new zsh shell and type in node -v I get command not found.

I'm not 100% sure what I'm supposed to see, but nvm list shows I have v.20.10.0 and v.18.19.0 installed.

nvm use v20.10.0 works and then I'm fine, but if I start another new shell I end up in the same place with no working node command

~/.zprofile has

eval "$(/opt/homebrew/bin/brew shellenv)"

if [ -f ~/.zshrc ]; then
. ~/.zshrc
fi

and ~/.zshrc contains

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

in it. I'm not quite sure how to resolve this.

0

There are 0 best solutions below