Different instalation processes of Node with pros and cons

There are THREE POSSIBLE WAYS to install Node in your computer.

You can choose any one of them.

Installing Node by pre-compiled binary (Wizard)

Probably the simplest way to install Node. Still you have a look at the advantages and disadvantages below and choose whether this is going to be the best suited installation process for you or not.

Advantages

  1. Easiest process: Wizard based installation, just like installing any other software.
  2. Automatic: It will configure the environment for you automatically.

Disadvantages

  1. Re-installation: To install any update, you need to download the package and reinstall it.
  2. Tough version switching: If you want to switch to some other version of Node, you need to reinstall again.

Installing in Mac, Windows or Linux

Just go to the download page of Node, select the file according to what operating system of which bit you use and download the required file (.exe for windows, .pkg for mac, .tar.gz for linux etc).

Double click on the file and the normal installation wizard will open. Just follow the steps and you will get both Node and npm (node packaged modules) installed in your computer.

Installing Node by NVM (Node Version Manager)

NVM (node version manager) is a multi-platform installation tool. I personally feel installing Node via NVM is the best way as switching versions is real easy. Still you have a look at the pros and cons given below.

Advantages

  1. Decent installation: Installation via Node Version Manager is not that hard. You just have to run some commands.
  2. Flexible versions: Switch between versions with very easily with short commands.

Disadvantages

  1. No wizard: You need to be familier with command line interfaces (which you probably will be, as node itself requires command line interfaces).
  2. Reinstalling global modules: While switching versions you may have to reinstall global modules.
  3. Not supported in Windows.

Installing in Mac

To install Node via NVM, you need to have NVM installed in your computer. Below are the steps you need to follow to completely install node.

  1. You need to have git in your computer. So if you don’t have git, kindly install.
  2. You need to have a C++ compiler. If you don’t have one, install Xcode.
  3. Open your terminal.
  4. Run this command:
    	$ curl https://raw.githubusercontent.com/creationix/nvm/v0.17.2/install.sh | bash
    	
  5. Now NVM is installed.
  6. Close your terminal and reopen it.
  7. Now NVM is ready and you can install Node. To do that, execute the command:
    $ nvm install NodeVersionNumber
    //Example:
    $ nvm install 0.10
    

    It will install that version or the latest version on that series for you.

  8. Now Node is installed. But you have to tell nvm always to use that particular version.
  9. To do that run the following command:
    $ nvm alias default NodeVersionNumber
    //Example:
    $ nvm alias default 0.10
    

    If you do not set default, each time you open up the terminal, you are not going to have node.

  10. You can install any other version of Node using the install command mentioned in point no#7.

Installing in Linux

Just like Mac, in Linux also you need to have NVM installed in your computer to install Node. Below are the steps you need to follow to completely install node.

  1. Open your terminal.
  2. Install git, if it is not already there. To install run the following command:
    $ sudo apt-get install git
    
  3. Install curl. To do that run the following command:
    $ sudo apt-get install curl
    
  4. Run this command:
    	$ curl https://raw.githubusercontent.com/creationix/nvm/v0.17.2/install.sh | bash
    	
  5. Now NVM is installed.
  6. Close your terminal and reopen it.
  7. Now NVM is ready and you can install Node. To do that, execute the command:
    $ nvm install NodeVersionNumber
    //Example:
    $ nvm install 0.10
    

    It will install that version or the latest version on that series for you.

  8. Now Node is installed. But you have to tell nvm always to use that particular version.
  9. To do that run the following command:
    $ nvm alias default NodeVersionNumber
    //Example:
    $ nvm alias default 0.10
    

    If you do not set default, each time you open up the terminal, you are not going to have node.

  10. You can install any other version of Node using the install command mentioned in point no#7.

Compile Node from github codebase

Advantages

  1. 100% updated: You will alwys get the latest things.
  2. Customization: If you have OS constraints or want to install node in a very specific way, you can go with this process.

Disadvantages

  1. Extra knowledge: You must be familier with the compilation process.
  2. Long process: Get it, read it, parse it, build it …. is really going to take time.
  3. Switch version: Recompilation needed in case of switching versions.

Installation in different environments

Node developers provide a decent step by step guide to install node by cloning the Node code base from github and compiling it. The process is larger but the documentation is well and good.
Please refere to Node installation doc to install Node in this way.


Still having issues?

If you still have issues understanding the above article, please leave a comment below and we will try to address that. In case you need help in your projects or understanding anything related to Programming; contact me, Paul Shan for assistance. Thank you for being a reader of VoidCanvas.

About This Author

Hello! I am Paul Shan, a JavaScript Expert, Full Stack and DevOps Engineer cum Consultant based out of Bengaluru, India.