In this tutorial, I’ll be teaching you how you can install Node.js on windows, mac or linux in under 15 minutes.
Node is an open-source runtime environment for javascript. It is a cross-platform environment providing its support for Mac, Windows and Linux. It runs Chrome’s V8 javascript engine, outside the browser, and because of this, it is very powerful.
It runs in a single process, without creating a new thread for every request. Node JS
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Latest LTS Version: 12.19.0 (includes npm 6.14.8) Download the Node.js source code or a pre-built installer for your platform, and start developing today.
How to Run a Node.js Application on a Mac. Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Installation on a Mac or Linux. In order to install everything on a Mac, we'll be running commands in Terminal.app, and Linux distributions vary. Install Node.js and npm. We’re going to use Node Version Manager (nvm) to install Node.js and npm. How to Download and Install Node.Js. 1) Visit the Node.JS website to download Node.JS. Scroll down a little bit to find the correct installer for your OS version. 2) The File Download dialog box appears prompting you to Save the download file. 3) Once the downloading is complete, double click the file to begin the installation of Node.JS. Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Latest Current Version: 14.13.1 (includes npm 6.14.8) Download the Node.js source code or a pre-built installer for your platform, and start developing today. In this article, we will see how to download and install Node js on Mac OS. Node js download and installation steps on Mac OS: 1. Go to website nodejs.org 2. Click on LTS version to start download. Then it starts download to Downloads directory in Mac OS. Once Download completes, double click on Continue reading How to download and install Node js on Mac OS. Node.js lets developers use JavaScript to develop wide variety of applications like network applications, command line tools, web api, web applicationsIn this document, we will cover installation procedure of nodejs on mac operating systemPrerequisitesThis guide assumes that you are using mac os.
How Does a Node App Look?
2 4 6 8 10 12 14 | constport=3000; constserver=http.createServer((req,res)=>{ res.setHeader('Content-Type','text/plain'); }); server.listen(port,hostname,()=>{ console.log(`Server running at http://${hostname}:${port}/`); |
How to Install Node.js?
These tools are required for developing a Node.js application on any platform.
- Node Package Manager or NPM*
- A text editor or an IDE
*NPM gets installed automatically when you install Node on your system.
Installation on Windows and MAC
To download node, you just need to visit the node’s official website and download the LTS version of node.
Once, downloaded, you’ll see an installer similar to this.
Hit install it as you install any other application on your Windows or Mac. Enter your system password if prompted.
And once done, the installer will prompt you a success message. You can now go ahead and delete the installer.
Installation on Linux
To install Node on your Ubuntu machine, run the following command:
2 | v12.16.0 |
Similarly, you can check the version of npm installed on your computer. Just paste the below node command to check the version.
2 | v6.13.4 |
Running Your First App
Here you are all set up, let’s try to run a small node server. Open VS Code and create a new file and save it as app.js
Now paste the following code.
2 4 6 8 10 12 14 | constport=3000; constserver=http.createServer((req,res)=>{ res.setHeader('Content-Type','text/plain'); }); server.listen(port,hostname,()=>{ console.log(`Server running at http://${hostname}:${port}/`); |
Now save the code and hit Ctrl + ~
This will open an integrated terminal of vs code in the same directory and from here you can directly run your js code.
Simply run the following command and hit enter.