How to install nodejs on Xampp localhost

前端 未结 7 2017
醉话见心
醉话见心 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: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.

提交回复
热议问题