M1 Mac nvm creating folder within repo

Viewed 33

I recently upgraded to an M1 mac and was having trouble with NVM. What would happen is that when I would open up or cd into a code repo, my Mac was creating a folder in the actual root of the code repo like:

Users/me/dev/coderepo/"/Users/me/dev/.nvm"

So anytime I changed node versions, or even started up a terminal I would have multiple changes that were stored in my git.

1 Answers

To fix this, I edited my /.zshrc:

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

The only change I did was remove the quotes that had been around "$HOME/.nvm" in the export NVM_DIR. I believe these entries are automatically added to your .zshrc during nvm installation. But, for whatever reason, on the M1, it caused this issue for me. I wanted to post my resolution here in case anyone experiences the same thing. I'm not sure if the M1 is causing this weirdness or if it's something to do with also have Rosetta installed. Who knows.

Related