0

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

user12457151
  • 853
  • 2
  • 12
  • 25
  • what operating system and version? Typically something must be added to the shell startup file to make sure the directories containing the programs you want are included in the path environment variables. – President James K. Polk Aug 25 '21 at 18:15
  • MacOS big sur 11.5.2! @PresidentJamesK.Polk, is that not what I did by adding the script in my post into zshrc and bashrc? I don't really understand how those shell files work just yet – user12457151 Aug 25 '21 at 21:22

0 Answers0