- Manually: use archive from Node web site.
- maintain version using NVM (Node version Manager).
- HomeBrew (Package Manager): '/usr/local/Cellar' with Base location: '/usr/local/'.
- Brew versions for node and other packages / formulas.
Manually Install: NVM - Node version manager
Step 1: Run following Command, by end of this command NVM will be installed
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash
Close and open your terminal, it's not necessary to log out, we just need to make sure changes nvm made to your part is actually reflected, by running following command:
$ source ~/.profile
Alternatively run the command suggested on output of script:
$ nvm ls-remote
Should you see the error, -bash: nvm: command not found it may be because git is not installed.
Go ahead and install git and return the script:
$ apt-get install git
Step 2:
And you will be shown a list of all the available versions of node.js. You can always find out the latest stable release by heading to the node.js website, where it's printed in the center of the page.
To install version 0.10.13 (the latest as of this writing) type:
$ nvm install 0.10.13
If you type:
$ node --version
You will now see that node v0.10.13 is installed and active. If you had an older node app that only works with node v0.8.16, and wanted to downgrade, then you would input:
$ nvm install v0.8.16
To install and switch to v0.8.16.
When you're done and want to switch back to v0.10.13, you can do so with nvm's use command:
$ nvm use v0.10.13
Nvm is great and makes switching between node versions easy and convenient. However, there's one caveat. If you type:
$ which node
Home Brew (Package Manager)
Step 1:
LM-SJN-00874861:0.12.0 anudixit$ brew tap homebrew/boneyard
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-boneyard'...
remote: Counting objects: 747, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 747 (delta 0), reused 0 (delta 0), pack-reused 744
Receiving objects: 100% (747/747), 181.57 KiB | 156.00 KiB/s, done.
Resolving deltas: 100% (348/348), done.
Checking connectivity... done.
Tapped 74 formulae
LM-SJN-00874861:0.12.0 anudixit$
Step 2:
LM-SJN-00874861:0.12.0 anudixit$ brew versions node
Warning: brew-versions is unsupported and will be removed soon.
You should use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
0.12.0 git checkout 1580f8b /usr/local/Library/Formula/node.rb
0.10.36 git checkout 06b10bc /usr/local/Library/Formula/node.rb
0.10.35 git checkout 51c3f4d /usr/local/Library/Formula/node.rb
0.10.34 git checkout 656117c /usr/local/Library/Formula/node.rb
0.10.33 git checkout 13848bb /usr/local/Library/Formula/node.rb
0.10.32 git checkout 72d9b70 /usr/local/Library/Formula/node.rb
0.10.31 git checkout 51dbf0b /usr/local/Library/Formula/node.rb
0.10.30 git checkout fa636a8 /usr/local/Library/Formula/node.rb
0.10.29 git checkout 7b968c6 /usr/local/Library/Formula/node.rb
0.10.28 git checkout f7d75de /usr/local/Library/Formula/node.rb
0.10.26 git checkout 0901e77 /usr/local/Library/Formula/node.rb
0.10.25 git checkout bae051d /usr/local/Library/Formula/node.rb
0.10.24 git checkout 8c47ff7 /usr/local/Library/Formula/node.rb
0.10.23 git checkout 5ab4328 /usr/local/Library/Formula/node.rb
0.10.22 git checkout 72f61d1 /usr/local/Library/Formula/node.rb
0.10.21 git checkout f8e98c8 /usr/local/Library/Formula/node.rb
0.10.20 git checkout 653960e /usr/local/Library/Formula/node.rb
0.10.19 git checkout 7973d20 /usr/local/Library/Formula/node.rb
0.10.18 git checkout b74c1c9 /usr/local/Library/Formula/node.rb
0.10.17 git checkout f7bbdcc /usr/local/Library/Formula/node.rb
0.10.16 git checkout 1782834 /usr/local/Library/Formula/node.rb
0.10.15 git checkout 89e0a43 /usr/local/Library/Formula/node.rb
0.10.14 git checkout dbc76e5 /usr/local/Library/Formula/node.rb
0.10.13 git checkout f88d5b8 /usr/local/Library/Formula/node.rb
0.10.9 git checkout ec5f331 /usr/local/Library/Formula/node.rb
0.10.8 git checkout ee99542 /usr/local/Library/Formula/node.rb
0.10.7 git checkout e44f345 /usr/local/Library/Formula/node.rb
0.10.6 git checkout 8583540 /usr/local/Library/Formula/node.rb
0.10.5 git checkout 3b589c5 /usr/local/Library/Formula/node.rb
0.10.4 git checkout 10e219d /usr/local/Library/Formula/node.rb
0.10.3 git checkout 71fd5b1 /usr/local/Library/Formula/node.rb
0.10.2 git checkout 91636ea /usr/local/Library/Formula/node.rb
0.10.1 git checkout bfb5239 /usr/local/Library/Formula/node.rb
0.10.0 git checkout 687062f /usr/local/Library/Formula/node.rb
0.8.22 git checkout 3c4a714 /usr/local/Library/Formula/node.rb
0.8.21 git checkout a3ef032 /usr/local/Library/Formula/node.rb
0.8.20 git checkout 9f95fff /usr/local/Library/Formula/node.rb
0.8.19 git checkout 4824d7c /usr/local/Library/Formula/node.rb
0.8.18 git checkout 07783c3 /usr/local/Library/Formula/node.rb
0.8.17 git checkout 59c35b9 /usr/local/Library/Formula/node.rb
0.8.16 git checkout 8aeaf15 /usr/local/Library/Formula/node.rb
0.8.15 git checkout fc6441e /usr/local/Library/Formula/node.rb
0.8.14 git checkout 11b5459 /usr/local/Library/Formula/node.rb
0.8.12 git checkout 3ae0e38 /usr/local/Library/Formula/node.rb
0.8.11 git checkout f24a5f5 /usr/local/Library/Formula/node.rb
0.8.10 git checkout 4c0b143 /usr/local/Library/Formula/node.rb
0.8.9 git checkout fb8447d /usr/local/Library/Formula/node.rb
0.8.8 git checkout 52bdfa1 /usr/local/Library/Formula/node.rb
0.8.7 git checkout ae6acb4 /usr/local/Library/Formula/node.rb
0.8.6 git checkout bfc71f7 /usr/local/Library/Formula/node.rb
0.8.5 git checkout 7b00c66 /usr/local/Library/Formula/node.rb
0.8.4 git checkout 7b2f682 /usr/local/Library/Formula/node.rb
0.8.3 git checkout 31f8d9f /usr/local/Library/Formula/node.rb
0.8.2 git checkout 50ae8e4 /usr/local/Library/Formula/node.rb
0.8.1 git checkout 9ff0a1d /usr/local/Library/Formula/node.rb
0.8.0 git checkout 01f8006 /usr/local/Library/Formula/node.rb
0.6.19 git checkout 83988e4 /usr/local/Library/Formula/node.rb
0.6.18 git checkout 653fb77 /usr/local/Library/Formula/node.rb
0.6.17 git checkout a3ecde3 /usr/local/Library/Formula/node.rb
0.6.16 git checkout ed17582 /usr/local/Library/Formula/node.rb
0.6.15 git checkout e18b02f /usr/local/Library/Formula/node.rb
0.6.14 git checkout 30813c8 /usr/local/Library/Formula/node.rb
0.6.13 git checkout 3b771d0 /usr/local/Library/Formula/node.rb
0.6.12 git checkout 0e8ea8a /usr/local/Library/Formula/node.rb
0.6.11 git checkout 3eec1f4 /usr/local/Library/Formula/node.rb
0.6.10 git checkout 7e202eb /usr/local/Library/Formula/node.rb
0.6.9 git checkout f752570 /usr/local/Library/Formula/node.rb
0.6.8 git checkout 74bff39 /usr/local/Library/Formula/node.rb
0.6.7 git checkout 9a52dcf /usr/local/Library/Formula/node.rb
0.6.6 git checkout 97fce9a /usr/local/Library/Formula/node.rb
0.6.5 git checkout 911726f /usr/local/Library/Formula/node.rb
0.6.4 git checkout 67a2615 /usr/local/Library/Formula/node.rb
0.6.2 git checkout 05b94b9 /usr/local/Library/Formula/node.rb
0.6.1 git checkout b6eb4fc /usr/local/Library/Formula/node.rb
0.6.0 git checkout 6bec7fc /usr/local/Library/Formula/node.rb
0.4.12 git checkout 3eea412 /usr/local/Library/Formula/node.rb
0.4.11 git checkout b6aa338 /usr/local/Library/Formula/node.rb
0.4.10 git checkout 523d360 /usr/local/Library/Formula/node.rb
0.4.9 git checkout 10b3ded /usr/local/Library/Formula/node.rb
0.4.8 git checkout 8d45d93 /usr/local/Library/Formula/node.rb
0.4.7 git checkout cb6a4b4 /usr/local/Library/Formula/node.rb
0.4.6 git checkout 7c0f0d9 /usr/local/Library/Formula/node.rb
0.4.5 git checkout 8241b81 /usr/local/Library/Formula/node.rb
0.4.4 git checkout 83753a9 /usr/local/Library/Formula/node.rb
0.4.3 git checkout f4a925d /usr/local/Library/Formula/node.rb
0.4.2 git checkout 0476235 /usr/local/Library/Formula/node.rb
0.4.1 git checkout 8a60de4 /usr/local/Library/Formula/node.rb
0.4.0 git checkout b4497ec /usr/local/Library/Formula/node.rb
0.2.6 git checkout 8602eee /usr/local/Library/Formula/node.rb
0.3.2 git checkout 168cb3d /usr/local/Library/Formula/node.rb
0.2.5 git checkout f55f417 /usr/local/Library/Formula/node.rb
0.2.4 git checkout 89438ae /usr/local/Library/Formula/node.rb
0.2.3 git checkout 730f311 /usr/local/Library/Formula/node.rb
0.2.2 git checkout 981bb41 /usr/local/Library/Formula/node.rb
0.2.1 git checkout c963a35 /usr/local/Library/Formula/node.rb
0.2.0 git checkout fbb93d9 /usr/local/Library/Formula/node.rb
0.1.104 git checkout ed51a5b /usr/local/Library/Formula/node.rb
0.1.103 git checkout f3e7c1b /usr/local/Library/Formula/node.rb
0.1.20 git checkout 2baa60c /usr/local/Library/Formula/node.rb
0.1.17 git checkout ab7697f /usr/local/Library/Formula/node.rb
0.1.14 git checkout a82e823 /usr/local/Library/Formula/node.rb
LM-SJN-00874861:0.12.0 anudixit$
Step 3:
LM-SJN-00874861:0.12.0 anudixit$ cd $( brew --prefix )
LM-SJN-00874861:local anudixit$ pwd
/usr/local
Step 4:
LM-SJN-00874861:local anudixit$ git checkout fa636a8 /usr/local/Library/Formula/node.rb
Step 5:
LM-SJN-00874861:local anudixit$ brew install node
Error: node-0.12.0 already installed
To install this version, first `brew unlink node'
LM-SJN-00874861:local anudixit$
Step 6:
LM-SJN-00874861:local anudixit$ brew unlink node
Unlinking /usr/local/Cellar/node/0.12.0... 8 symlinks removed
LM-SJN-00874861:local anudixit$
Step 7:
LM-SJN-00874861:local anudixit$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-0.10.30.mavericks.bottle.2.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
Error: Failed to download resource "node"
Download failed: https://homebrew.bintray.com/bottles/node-0.10.30.mavericks.bottle.2.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/node/0.10.30 --without-npm
==> make install
==> Downloading http://registry.npmjs.org/npm/-/npm-1.4.9.tgz
######################################################################## 100.0%
==> make install
==> /usr/local/bin/npm update npm -g --prefix /usr/local
/usr/local/Cellar/node/0.10.30: 1547 files, 19M, built in 2.4 minutes
LM-SJN-00874861:local anudixit$
Step 8:
LM-SJN-00874861:local anudixit$ cd /usr/local/Cellar/node
LM-SJN-00874861:node anudixit$ ls
0.10.30 0.12.0
Step 9:
LM-SJN-00874861:local anudixit$ brew unlink node
Unlinking /usr/local/Cellar/node/0.10.30... 5 symlinks removed
LM-SJN-00874861:local anudixit$ git checkout -- Library/Formula/node.rb
LM-SJN-00874861:local anudixit$ brew install node
Warning: node-0.10.30 already installed, it's just not linked
LM-SJN-00874861:local anudixit$ brew link node
Linking /usr/local/Cellar/node/0.10.30... 5 symlinks created
LM-SJN-00874861:local anudixit$ node -v
v0.10.30
LM-SJN-00874861:local anudixit$
Step 10: Switch Versions
LM-SJN-00874861:node anudixit$ brew switch node 0.12.0
Cleaning /usr/local/Cellar/node/0.10.30
Cleaning /usr/local/Cellar/node/0.12.0
6 links created for /usr/local/Cellar/node/0.12.0
LM-SJN-00874861:node anudixit$ node -v
v0.12.0
LM-SJN-00874861:node anudixit$ brew switch node 0.10.30
Cleaning /usr/local/Cellar/node/0.10.30
Cleaning /usr/local/Cellar/node/0.12.0
5 links created for /usr/local/Cellar/node/0.10.30
LM-SJN-00874861:node anudixit$ node -v
v0.10.30