Node.js Installation & Setup

Node js 6 min min read Updated: Mar 29, 2026 Beginner
Node.js Installation & Setup
Beginner Topic 2 of 12

Node.js Installation Tutorial

Installing Node.js is the first step toward building backend applications, APIs, command-line tools, and full-stack JavaScript projects. Node.js provides the runtime environment, while npm, which is installed along with Node.js, gives you access to thousands of reusable packages and libraries.

The installation process is simple, but it is important to verify that both Node.js and npm are properly installed on your system. Once the setup is complete, you can start creating and running JavaScript applications directly from your machine.

What You Need Before Installation

Before installing Node.js, make sure you have:

  • A computer running Windows, macOS, or Linux
  • Internet access to download the installer
  • Basic knowledge of how to open the terminal or command prompt

Node.js is cross-platform, so the steps are very similar across operating systems. The most common and beginner-friendly method is to download the installer from the official Node.js website and follow the setup wizard.

Installation Steps

To install Node.js, visit the official Node.js website and download the recommended version for your operating system. In most cases, you will see two versions:

  • LTS (Long Term Support): Best for most users because it is stable and recommended for production use
  • Current: Includes the latest features but may change more frequently

If you are a beginner or setting up a project for practical use, it is usually better to choose the LTS version. It provides better stability and broader support in the development community.

After downloading the installer, open it and follow the on-screen instructions. The setup wizard will install:

  • Node.js runtime
  • npm (Node Package Manager)
  • Optional tools such as PATH configuration
Tip: Keep the option to add Node.js to your system PATH enabled during installation. This allows you to run node and npm commands from anywhere in the terminal.

How to Verify the Installation

Once the installation is complete, the next step is to confirm that Node.js and npm are working correctly. Open your terminal, command prompt, or PowerShell and run the following commands:

bash node -v npm -v

The first command checks the installed version of Node.js, and the second command checks the installed version of npm. If both commands return version numbers, it means the installation was successful.

Output

v20.x.x

You may see a different version number depending on the version you installed. That is completely normal. The important thing is that the commands should return version values instead of showing an error.

Understanding These Commands

node -v

This command tells you which version of Node.js is installed on your machine. It is useful when checking whether your environment matches the version required by a project.

npm -v

This command shows the installed version of npm. npm is the package manager that comes bundled with Node.js, and it is used to install frameworks, libraries, and tools such as Express, React, TypeScript, and many others.

Why npm Matters

When you install Node.js, npm is automatically installed as well. This is important because npm is one of the most useful parts of the Node.js ecosystem. It allows developers to:

  • Install project dependencies
  • Manage package versions
  • Run scripts defined in package.json
  • Share reusable code packages

In real projects, npm helps you avoid building everything from scratch. Instead, you can install trusted libraries and focus on writing the main business logic of your application.

Common Installation Issues

1. Command not found

If the terminal shows an error such as 'node' is not recognized or command not found, it usually means Node.js was not added to the system PATH correctly.

In that case, try closing and reopening the terminal. If the issue continues, reinstall Node.js and ensure the PATH option is enabled.

2. Old version still showing

Sometimes an older version of Node.js remains active on the system. This can happen if Node.js was installed previously from another source. You may need to uninstall the older version first and then install the latest stable version again.

3. npm not installed properly

In rare cases, Node.js may install correctly but npm may not work as expected. Reinstalling Node.js usually fixes the issue because npm is bundled together with it.

Installing Node.js on Different Operating Systems

Windows

On Windows, download the .msi installer from the official website and run it like any other software installation package. Follow the setup wizard, accept the license agreement, and keep the default settings unless you have a specific reason to change them.

macOS

On macOS, you can download the .pkg installer from the official website and install it through the package wizard. Many developers also use package managers such as Homebrew, but beginners usually find the official installer easier.

Linux

On Linux, Node.js can be installed either from the official installer, the system package manager, or version managers such as nvm. For beginners, using official instructions or a package manager is the easiest starting point.

What to Do After Installation

After confirming that Node.js and npm are installed, you can begin using them for development. A common next step is to create a new project folder and initialize it with npm.

bash mkdir my-node-app cd my-node-app npm init -y

This creates a new folder, moves into it, and generates a package.json file. The package.json file is important because it stores your project metadata, dependencies, and scripts.

Simple Test After Installation

To make sure Node.js is working correctly, create a file named app.js and add the following code:

javascript console.log("Node.js is installed successfully");

Then run:

bash node app.js

If the message appears in the terminal, your Node.js setup is ready to use.

Output

Node.js is installed successfully

Best Practice for Beginners

If you are just getting started, avoid installing too many extra tools in the beginning. First, make sure the core setup works properly:

  • Node.js installed successfully
  • npm installed successfully
  • Version commands are working
  • A simple JavaScript file runs without errors

Once these basics are working, you can move on to installing frameworks like Express.js or tools like nodemon.

Conclusion

Installing Node.js is straightforward, but verifying the installation is just as important as downloading it. By checking node -v and npm -v, you confirm that both the runtime and package manager are ready to use.

After installation, you can begin building server-side applications, APIs, automation scripts, and many other types of JavaScript projects. A proper Node.js setup creates the foundation for your entire development journey.

Quick Summary: Download Node.js from the official website, install the recommended version, and verify the setup using node -v and npm -v.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators