4

Hoping you can help me figure out this issue!

I just bought a new MacBook and was getting my development environment set up today. I installed XCode, Brew, NVM, and Git. When I installed Git, I had to change it so it was the first in the path so I could avoid using Apple Git, and I think that severely messed things up.

For some reason, nvm was not showing when I was running: nvm ls or nvm ls-remote

Yet when I told brew to install nvm, it said it was already installed. OK. Eventually was able to get it sorted out and install node and such.

Fast forward to now, I went to run node in the terminal. Node was not found. Did some research and found that I should not install nvm with homebrew, so I did brew uninstall nvm and brew cleanup and then installed through the recommend github repository.

I ran the necessary commands and added to my PATH, and when I ran command -v nvm, nvm was returned. GREAT. Then I ran the other commands to install Node and I was able to use it, until I closed the terminal.

Now when I reopen the terminal and run node, it returns command not found. Command -v nvm does not return anything too.

Please help - it's been such a headache and I can't seem to figure out whats going on. Every solution I'm finding on Stack Overflow works until I close the terminal.

Madison Leopold
  • 377
  • 4
  • 18

1 Answers1

9

I was able to figure it out. The command all NVM guides tell you to run in order to start running node was not properly added to .bashrc.

Use these as a reference if you have the same issue as me: https://itnext.io/nvm-the-easiest-way-to-switch-node-js-environments-on-your-machine-in-a-flash-17babb7d5f1b .bashrc: Permission denied

Madison Leopold
  • 377
  • 4
  • 18
  • Yes! Basically you just need to add following lines to your .bashrc file: 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 – A. D'Alfonso May 05 '20 at 22:03
  • same issue as above, ran `nvm alias default node` per the link and restarted terminal, seemed to resolve the issue – Jimmy Long May 19 '23 at 06:05