Installation and Setup

Overview

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It allows developers to run JavaScript on the server side, and has become a popular choice for building server-side applications.

In this guide, we will walk you through the process of installing and setting up Node.js on your local machine.

Prerequisites

Before installing Node.js, you should have:

  • A computer running a supported operating system (Windows, macOS, or Linux)
  • A command-line interface (CLI) installed on your computer
  • Administrator access to install software on your computer (if necessary)

Installing Node.js

  1. Visit the Node.js website and download the installer for your operating system.

  2. Double-click the installer file to begin the installation process.

  3. Follow the on-screen instructions to complete the installation.

  4. Verify that Node.js has been installed by opening a command prompt or terminal window and typing the following command:

node -v

This command will display the version number of Node.js that is currently installed on your system.

Setting up Node.js

Once Node.js is installed, you can start using it to run JavaScript code on your computer.

To get started, create a new file with the .js extension and add some JavaScript code to it. For example:

console.log("Hello, world!");

Save the file, then open a command prompt or terminal window and navigate to the directory where the file is saved.

To run the code in the file, type the following command:

node filename.js

Replace filename with the name of your file (without the .js extension). This will execute the JavaScript code in the file and display the output in the command prompt or terminal window.

Congratulations!

You have successfully installed and set up Node.js on your local machine. You can now start exploring the many features and capabilities of this powerful JavaScript runtime.

This page was updated on -