Issue
I have installed NVM. Each time I close the terminal and open it back up, NVM disappears and my node version rolls back from 14 to 12.
Every time I open my terminal back up, I notice the node version rolls back. I try to use nvm, and will get bash: nvm: command not found
. I have to run this script again to get it working every time.
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
I noticed the meta description when you google NVM says it's designed to be used per-user and invoked per shell. However, the setup article linked in the first SO post below mentioned installing, killing the terminal, and opening it back up with nvm still being loaded.
Anyone know what I can do so that I don't have to reinstall nvm every time I open the terminal?
Steps taken to resolve
- I have reviewed this SO post and also this one. From those two I have tried the following suggestions:
- I have run
nvm alias default v14.17.1
in my root directory - I have pasted the following script into both .zshrc and .bashrc
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Edit: I am on MacOS Big Sur 11.5.2