Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install nodejs on Xampp localhost

Been seeing a lot of how to's on how to install nodejs but nothing is at all clear.

So I ask...

Can someone provide a step by step installation guide for installing and using nodejs on a xampp server?

like image 897
KArneaud Avatar asked Aug 08 '13 21:08

KArneaud


People also ask

Can I use node js with xampp?

It is not possible to install NodeJs on Xammp. Because Xammp is is simply a tool where Apache,MySql,FileZilla,Tomcat and Mercury server are available. Where you will be able to only configure and use these server. If you want to install Nodjs on Windows Machine, You will have to install it manually.

How do I run node js on Apache server?

Hosting a nodejs site through apache can be organized with apache proxy module. Do not enable proxying with ProxyRequests until you have secured your server. Open proxy servers are dangerous both to your network and to the Internet at large. Setting ProxyRequests to Off does not disable use of the ProxyPass directive.

How to connect NodeJS with XAMPP?

We can easily connect the Nodejs with xampp by follow simple steps - Nodejs required a specfic port to run on system and defaluts port is 8080, So let's starts Download Nodejs form its website,If node is installed successfully then open terminal or Git Bash to check

How do I install npm packages with XAMPP?

NPM is included in the installer and will be installed alongside Node. After that is done, installing NPM packages is simply a matter of heading to your desired directory and executing npm install <PACKAGE_NAME> there. In general, XAMPP helps you with your back end. Not your front end. Does this mean that I cannot use them? No.

How to install XAMPP on Linux?

Run command : node -v and npm -v it gives node version ,If it shows then you installed the node successfully. Now Install Xampp (If not installed )download.html, and run Apache , If no error on, then we are almost done.

How do I use NPM with Node JS?

In order to be able to use NPM though, since NPM is written in JavaScript, you will need to install Node.js, also on your machine. So, head over to the Node.js site and download and install Node. NPM is included in the installer and will be installed alongside Node.


1 Answers

After searching (source), I have found, that it's easier to install Node.js directly (so, no need of XAMP/WAMP):

  1. Install http://nodejs.org/download/

  2. Create a test file (example) C:\myFolder\test.js and put this code in that file:

var http = require('http'); http.createServer(function (req, res) {   res.writeHead(200, {'Content-Type': 'text/plain'});   res.end('Hello World\n'); }).listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/'); 
  1. Open CMD (COMMAND PROMPT) and execute:

    node C:\myFolder\test.js

  2. Open this address in your browser: http://127.0.0.1:1337/

like image 171
T.Todua Avatar answered Sep 20 '22 02:09

T.Todua