Config NVM
Add the following snippet to ~/.zshrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
Install NVM and Node
The node will be installed to NVM_DIR
, so you need to create that folder if it does not exists.
mkdir /Users/sloppysun/.nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
# You can install multiple versions
nvm install 10
nvm install 12
# Switch to one of the versions
nvm use 10
Install Yarn
curl -o- -L https://yarnpkg.com/install.sh | bash
Reference
- https://github.com/nvm-sh/nvm
- https://yarnpkg.com/lang/en/docs/install/