How to install nodejs on Xampp localhost

前端 未结 7 1950
醉话见心
醉话见心 2020-12-23 16:23

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 installat

相关标签:
7条回答
  • 2020-12-23 17:02

    I never gave a lot of answers on this site. Because most of the time I'm not an expert however. I had the same issue a while back.

    1) You don't really need this XAMPP. Node will create its own http_server so I suggest you just forward calls from XAMPP to the Node app.

    2) a good start would be: nodeguide.com/beginner.html

    3) I work with PHPstorm which is very nice for Node.js development.

    3a) Node.js plugin -> https://www.jetbrains.com/phpstorm/help/installing-updating-and-uninstalling-repository-plugins.html

    3b) read this: http://blog.jetbrains.com/webstorm/2014/01/getting-started-with-node-js-in-webstorm/

    3c) running: http://blog.jetbrains.com/webstorm/2014/02/running-and-debugging-node-js-application/ 3d) Test your app. You mighht also need this:

    4) (MysQl db) https://codeforgeek.com/2015/01/nodejs-mysql-tutorial/

    0 讨论(0)
  • 2020-12-23 17:05

    If you want to run javascript from apache you can do it as CGI module. It wont be exacly node.js server and performance because Apache is your server, but you can execute node.js like scripts http://www.cgi-node.org/

    You must add a handler to your apache configuration to handle whatever extension files for example .jss via CGI modlue that essentially calls node(.exe) depndeing if linux or windows. I made it work under Bitnami WAMP

    0 讨论(0)
  • 2020-12-23 17:08

    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.

    0 讨论(0)
  • 2020-12-23 17:09

    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/');


    3) Open CMD (COMMAND PROMPT) and execute:
    node C:\myFolder\test.js
    

    4) Open this address in your browser: **`http://127.0.0.1:1337/`**
    0 讨论(0)
  • 2020-12-23 17:17

    Now It's really easy to install and use Node.js even with Apache if you are using Xampp/Wamp etc. Because unlike old days, now Node.js org has created MSI installer for windows. Below are the steps to install Node.js with Apache. It is assumed that you have already installed xampp

    Download windows installer of Node.js from it's site http://nodejs.org/ click on download. Hit the Node.js website and click the big green Install button. It'll detect your OS and give you the appropriate installer. If for some reason it doesn't, click the downloads button and grab the one you need. Run the installer. That's it, you have installed Node.js and, equally, NPM – Node Package Manager – which lets you add all kinds of great stuff to Node quickly and easily.

    Note

    Keep your Apache and Node ports different. Declare Node port other than 80 or 8080 while creating server in Node because these are the default ports of Apache.

    May be these Notes may help someone in future.

    1) When Node.js is installed Node and NPM become available globally. Means that you can create your site anywhere on your hard drive and with command prompt go to your directory like in Windows Command prompt

    d:/NodeSite/node server.js
    

    and now you can access it via

    http://localhost:3000
    

    because your server.js is running with node.

    2) Similarly, you can install any Node Package like installing Memcached package or Library

    d:/NodeSite/npm install memcached
    

    "NodeSite" is a folder contain your project. You can see that node and npm have become globals.

    0 讨论(0)
  • 2020-12-23 17:26

    XAMPP and a node.js is two different things, which do not need to work together, nor do they need each other.

    XAMPP consists of Apache, MySQL, PHP and Perl.

    Where node.js is just like PHP or Apache, so an application.

    Node.js can be installed from the website, http://nodejs.org or via the terminal following these instructions:

    https://github.com/joyent/node/wiki/Installation

    0 讨论(0)
提交回复
热议问题