With the latest macOS update comes zsh (or z shell) and with it comes some issues, one of them is how complicated it is to install NVM so here is how to do it.
Before you get started, make sure that you have zsh as your current running shell, to do so run the following in your terminal:
echo $0
, if you're using zsh then you should see the following output -zsh
.Start downloading and running the install script for NVM, you can find more about this in its repo (https://github.com/nvm-sh/nvm):
- Hi I'm trying to install mac os Catalina With OpenCore 6.1 on my new Crucial P1 Nvme After preparing the BIOS and USB I started the installation process and when I.
- Restart terminal and install the latest version of Node. Nvm install node. Run the final command to confirm node is installed. Nvm use node node -v && npm -v #confirm the install worked.
The issue with Hombrew and Catalina, re-installing npm via NVM still persist. The command compaudit xargs chmod g-w was the best method that worked for my system. Copy link torgeir commented Jan 25, 2021.
After the installation, you'll need to add the code below to the startup file, this sets up the alias for NVM to make sure that it's always available on your shell even after it was closed and opened again
Open the startup file using nano, paste the code above then save the file.
Open a new terminal window and test your nvm installation by running
nvm --version
.As a developer, switch version of Node always for capable client?s demand or environment without review code again.
and nvm is one way of switch versions of node.
Please NEVER install it in this way (brew install).
If you did, I will show you how to clear and install it in the correct way step by step.
on Mac, from the beginning I launch terminal:
$ brew install nvm
then write an alias to terminal profile as
$ echo “source $(brew –prefix nvm)/nvm.sh” >> .bash_profile
my terminal is iTerm, zsh and on-my-zsh not bash so it is
$ echo “source $(brew –prefix nvm)/nvm.sh” >> .zhsrc
activate configuration :
$ ~/.bash_profile
to zsh:
$ . ~/.zshrc
then choose any version of node, like v6.5.0, just type
$ nvm install v6.5.0
then use this version of node
$ nvm use v6.5.0
it shows something wrong as below:
nvm is not compatible with the npm config “prefix” option: currently set to “/Users/fabian/.nvm/versions/node/v6.5.0” Run `nvm use – delete-prefix v6.5.0` to unset it.
After studying some feedback on GitHub. there is a correct way to install nvm.
First of all, remove node files controlled by nvm.
$ npm ls -g ? depth=0#check all module installed.$ sudo rm -rf /usr/local/lib/node_modules#delete node_modules folders$ sudo rm /usr/local/bin/node#delete node$ cd /usr/local/bin && ls -l | grep “../lib/node_modules/” | awk ?{print $9}?| xargs rm#delete global node module alias
restart terminal, then install nvm by curl
Install Nvm Mac Catalina Os
Best Way to install NVM is HERE ?
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
The reason to happen the message seems brew doesn?t write the correct alias to terminal profile, it will happen something wrong if install nvm via brew on Mac.
Final Step:
Install Nvm Mac Catalina
You?ll find something added into .bash_profile, if you use zsh, add below line to ~/.zshrc
export NVM_DIR=”$HOME/.nvm”[ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh” # This loads nvm
Install Nvm Mac Catalina Download
DONE!! Terminal Happy!
you may want to check the official document of NVM, here is the link:https://github.com/nvm-sh/nvm