- Homebrew should be installed (Command line tools for Xcode are included).
-
Install
nvmvia Homebrew$
brew install nvm -
Create system directory for nvm
$
mkdir ~/.nvm -
Add following line to your profile. (
.profileor.zshrcor.zprofile)# NVM export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh
-
Close and open your terminal again. Or Choose one from the following command once for reload your profile. (
.profileor.zshrcor.zprofile)Example
- $
source ~/.profile - $
source ~/.zshrc - $
source ~/.zprofile
- $
-
Verify
nvmis installed$
nvm -v -
Check all avaliable version by this command
$
nvm ls-remote -
Install NodeJS (Recommended to install LTS version. Current LTS is 8.10.0)
$
nvm install 8.10.0 -
Check installed NodeJS in your machine.
$
nvm ls -
Set global nodejs version to environment.
$
nvm use default
See more about nvm : https://github.com/creationix/nvm
-
Install
yarnvia Homebrew withoutnodedependencies$
brew install yarn --ignore-dependencies -
Checkout
nodein environment$PATH$
which nodeIt should be return =>
/User/<your's-user-name>/.nvm/versions/node/8.10.0/bin/node -
Checkout
brew doctorthere should show message WARNING missing yarn dependencies$
brew doctor -
Create symbol link from
nvmfor Homebrew$
ln -s ~/.nvm/versions/node/ /usr/local/Cellar/** Note : If you installed multiple node versions via
nvm. You should create symbol link by current global version. Following this commands **$
nvm current=> v8.10.0$
mkdir /usr/local/Cellar/node$
ln -s ~/.nvm/versions/node/8.10.0/ /usr/local/Cellar/node -
Checkout
brew doctoragain. There shouldn't have WARNING message.$
brew doctor