Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 204
user3448600 Avatar asked Oct 12 '16 13:10

user3448600


People also ask

Can I install node with homebrew?

Use Homebrew to install Node. js on MacOS. Homebrew is a better way to manage various packages on your Mac.

How do I install a specific version of node js?

How To Install A Specific Version Of A Package. You can use the npm install command to download and install a package on your development environment. By default, the npm install command fetches the latest available version of the specified package—in this case, it's Renovate version 24.52.

How do I install a specific version of node js in Ubuntu?

If you're looking to install newer versions, like 0.11. x: (1) sudo apt-add-repository ppa:chris-lea/node. js-devel (2) Update: run sudo apt-get update (3) Then, to list the latest packages: sudo apt-cache showpkg nodejs (4) For example, to install 0.11. 14: sudo apt-get install nodejs=0.11.


2 Answers

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 
like image 152
Iryston Avatar answered Nov 05 '22 10:11

Iryston


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.

like image 39
Ankit Avatar answered Nov 05 '22 08:11

Ankit