How to install LTS version of nodejs via homebrew
When I run brew install node
it install v6.7.0 Current
but I want LTS version which is at the time of this writing v4.6.0 LTS
. Which commands I need to issue to install LTS version of Node via Homebrew.
Solution 1:
You can use
brew install node@4
, brew install node@6
, or brew install node@8
command to install LTS version of Node via Homebrew.
If another version of Node is already installed, you should uninstall it first to avoid conflicts.
Also note that LTS versions of node (e.g. node@10) are keg-only and must either be linked with --force (brew link --force node@10
) or you need to add the binary to your path by running:
echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bashrc
Solution 2:
You can always look up LTS and stable versions from node releases page and also look at homebrew formulae here.
It shows how u can install stable version vs other versions.
For example right now, brew install node@10
will install LTS version 10.16.