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
Hi @satishnani,
The automated script I would like to do it too. But I don't have a plan to do that for now. Lets me explain about this gist :)
This is a simple step (The step are outdated. Move to repo) for peoples who would like to install
yarn
andnvm
andnode
with Homebrew. Just an option.Anyway, there have many solutions to install your
node
.And the purpose of starting to write down this gist. I just noted for my self
I had noted this gist for two years ago and I forgot about this.
One day I found many stargazers to this gist.
So I just answer their question who asked me in this thread.
BTW, I have a recommended automated script repository. Maybe you can check out here thoughtbot/laptop