node.jshomebrewnvm

Nvm and Node keep going missing upon closing terminal


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.


Solution

  • 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