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
nvmvia Homebrew$
brew install nvmCreate system directory for nvm
$
mkdir ~/.nvmAdd following line to your profile. (
.profileor.zshrcor.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. (
.profileor.zshrcor.zprofile)Example
- $
source ~/.profile- $
source ~/.zshrc- $
source ~/.zprofileVerify
nvmis installed$
nvm --versionCheck all avaliable version by this command
$
nvm ls-remoteInstall NodeJS (Recommended to install LTS version. Current LTS is Dubnium)
$
nvm install --lts='Dubnium'Check installed NodeJS in your machine.
$
nvm lsSet global nodejs version to environment.
$
nvm use defaultSee more about
nvm: https://github.com/creationix/nvm
Install
yarnvia Homebrew and removenodedependencies from Homebrew$
brew install yarn$
brew uninstall node --ignore-dependenciesCheckout
nodein environment$PATH$
which nodeIt should be return =>
/User/<your's-user-name>/.nvm/versions/node/<latest-node-lts-version>/bin/nodeCheckout
brew doctorthere should show message WARNING missing yarn dependencies$
brew doctorCreate symbol link from
nvmfor 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/nodeCheckout
brew doctoragain. There shouldn't have WARNING message.$
brew doctor
@zmaleki
Thanks for your advice.
This depends on Unix user (Actually, I meant to Mac user) who uses the shell either
bash/zsh/fishor others shellYou added those lines to
~/.bash_profilebecause you use thebash.macOS Catalina changed the default shell to
zshI had used
zshsince macOS MavericksBTW
This gist is outdated.
This moved from the gist to the Github repository.
Try again at https://github.com/nijicha/install_nodejs_and_yarn_homebrew