w3resource

Installing Node.js on Windows and Linux

Introduction

There is a number of ways to install Node.js on Linux, and windows. Here are some instructions for installing Node.js on windows and Linux distributions.

Current version: : v0.10.26

Installing Node.js on Windows

Windows Installer (.msi) :

Download 32 bit from here : http://nodejs.org/dist/v0.10.26/node-v0.10.26-x86.msi

Download 64 bit from here : http://nodejs.org/dist/v0.10.26/x64/node-v0.10.26-x64.msi

Installation in 32-bit -

Step - 1 : Double clicking on node-v0.10.26-x86.msi the following screen will come -

install node msi version on windows step1

Seep - 2 : Clicking on Run button the following screen will come -

install node msi version on windows step2

Step -3 : Accept the license agreement and click on next button :

install node msi version on- indows-step3

Step - 4 : Here "C:\Program Files\nodejs\" is the default folder name, you can change the folder name. Click on next -

install node msi version on windows step4

Step - 5 : Click the icons in the tree to change the way features will be installed , Click next -

install node msi version on windows step5

Step-6 : Click Install to begin the installation. Click Back to review or change any your installation settings. Click cancel to exit the wizard :

install node msi version on windows step6

Installation in progress :

install node msi version on windows step7

Click the Finish button to exit Setup wizard.

install node msi version on windows step7

Let check the path command which sets the command path in the PATH environment variable, which is the set of directories used to search for executable files. Used without parameters, path .

PATH=C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Windows\system32;
C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;
c:\python32\python;C:\MinGW\bin;C:\Program Files\GTK2-Runtime\lib;
C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\nodejs\;
C:\Users\rg\AppData\Roaming\npm

Now you can check the version of Node :

node,js version test

To get Node REPL type node and press enter :

install node.exe on windows step2

Windows Binary (.exe) :

Download 32 bit from here : http://nodejs.org/dist/v0.10.26/node.exe

Download 64 bit from here : http://nodejs.org/dist/v0.10.26/x64/node.exe

Installation in 32-bit -

Step - 1 : Double clicking on Node.exe the following screen will come :

install Node.exe on windows step1

Clicking on Run button the following Node's REPL command line will come :

install node.exe on windows step2

Version test :
Goto the dir where node.exe is present (as node.exe is not set in a search path for executable files) and execute the following command.

Node.js version

If you get an output like shown above, then you have successfully installed Node.js in your machine.

Installing Node.js on Linux

From Source

In the following part of the tutorial, we will see how to install Node.js on Ubuntu Linux. If you are installing Node.js from source, then installation process will be similar in all linux operating systems.

Clone Node.js from the Github using the following command.

install node msi version on linux step1
install node msi version on linux step2

After a while, you will find that the Node source code is copied to the 'node' folder.

install node msi version on linux step3

Issuing the following command, make sure that you have proper permission set on node folder.

install node msi version on linux step4

Using './configure' create the make file we will use in a moment.

install node msi version on linux step5

Issue make.

install node msi version on linux step6

Issue make install to complete the installation.

install node msi version on linux step7

Once you arrived till the last command showed, you may arrive at any directory in your file system and issuing 'node --version' will show you the version of the Node.js you have ended up installing.

install node msi version on linux step8

Using package manager

Beside installing from source code, you may install Nodejs using the package manager also. In the following part of the tutorial, we will discuss how to install nodejs on Ubuntu using package manager.

Note that, while issuing the following commands, we have logged in as root. if you are not logged in as a different user (which is common), you may need to add 'sudo ' before all of the commends shown below.

Run apt-get update to make sure that your system is upto date.

install node on linux using package manager step1

Nodejs has some prerequisites. Using apt-get, install those now.

install node on linux using package manager step1

Add the required repository to install nodejs.

install node on linux using package manager step3

Now install nodejs issuing the following command.

install node on linux using package manager step4

Now, run node --version command from the prompt shown above.

install node on linux using package manager step5

If you are using any other Linux distribution than Ubuntu, you got to find the proper repository for that.

Previous: Introduction
Next: Programming Model



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/node.js/installing-node.js-windows-and-linux.php