Tag Archives: How to install nodejs on Xampp localhost

How to install nodejs on windows


How to install nodejs on windows : To install node.js on windows is very easy and simple. Follow the steps below and start working with node.js without wasting your time.


How to install nodejs on windows

Steps to install node js.

1. Download the appropriate(compatible with your windows) node.js from : http://nodejs.org/
2. Run the downloaded file.
3. After installing successfully let us run our first program.

Now create a file called as server.js place it in the folder where node.exe is placed.
server.js location:

how to install nodejs on windows

how to install nodejs on windows

Server.js file will contain :

var http = require('http');

http.createServer(function (request, response) {
    console.log('request starting...');

    response.writeHead(200, { 'Content-Type': 'text/html' });

    var html = '

Hello Tutorialsplane!

'; response.end(html, 'utf-8'); }).listen(8125); console.log('Server running at http://127.0.0.1:8125/');

Or Just Download the server.js file from here and place it in nodejs folder as in above image.

Download server.js

4. Now Open cmd.exe

Cmd

Cmd

5. Now run the following command :

“cd c:\path\to\the\node\executable” where node.exe exists.
For example my node.exe resides in the folder “C:\Program Files\nodejs>node”


C:\Program Files\nodejs>node server.js

After running this command you will see as following :

run node.js on windows

run node.js on windows

6. Now Open your browser and access http://127.0.0.1:8125/ in the address bar. You will see the following message :

Hello Tutorialsplane!