Dear all Github friends,
I moved this gist to the Github repository.
Following this repository https://github.com/nijicha/install_nodejs_and_yarn_homebrew
Thanks for star me 😃
- Homebrew should be installed (Command line tools for Xcode are included).
Install
nvm
via Homebrew$
brew install nvm
Create system directory for nvm
$
mkdir ~/.nvm
Add following line to your profile. (
.profile
or.zshrc
or.zprofile
)# NVM export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.shClose and open your terminal again. Or Choose one from the following command once for reload your profile. (
.profile
or.zshrc
or.zprofile
)Example
- $
source ~/.profile
- $
source ~/.zshrc
- $
source ~/.zprofile
Verify
nvm
is installed$
nvm --version
Check all avaliable version by this command
$
nvm ls-remote
Install NodeJS (Recommended to install LTS version. Current LTS is Dubnium)
$
nvm install --lts='Dubnium'
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
yarn
via Homebrew and removenode
dependencies from Homebrew$
brew install yarn
$
brew uninstall node --ignore-dependencies
Checkout
node
in environment$PATH
$
which node
It should be return =>
/User/<your's-user-name>/.nvm/versions/node/<latest-node-lts-version>/bin/node
Checkout
brew doctor
there should show message WARNING missing yarn dependencies$
brew doctor
Create symbol link from
nvm
for Homebrew. Pick a choice which suitable for you.a. This is for those who installed only one version via nvm
$
ln -s ~/.nvm/versions/node/ /usr/local/Cellar/
b. If you installed multiple node versions via
nvm
. You should create symbol link by current global version. Following this commands$
nvm current
=> v10.16.0 (Latest LTS: Dubnium) (This should be Global node version)$
mkdir /usr/local/Cellar/node
$
ln -s ~/.nvm/versions/node/<latest-node-lts-version>/ /usr/local/Cellar/node
Checkout
brew doctor
again. There shouldn't have WARNING message.$
brew doctor
I follow all of this gist. When Finally, I ran
brew doctor
, I can getSo I ran
brew link --overwrite node
. And then the warning is removed.Is this right way? I dont know