Paramclasses Academy - Blog

Tutorials Details

←
Post 3 of 40
→

How to Install Node.js and npm on Windows, macOS and Linux

How to Install Node.js and npm on Windows, macOS and Linux

October 29, 2026

✦ How to Install Node.js and npm on Windows, macOS and Linux


✦ Introduction

Node.js is a popular JavaScript runtime environment used to develop backend applications, web servers, REST APIs, and real-time applications. Before starting Node.js development, you need to install Node.js and npm on your computer.

Node.js allows you to execute JavaScript outside a web browser, while npm helps you install and manage packages required for your projects.

The installation process is straightforward, but the steps can vary depending on your operating system.

In this tutorial, Param Classes explains how to install Node.js and npm on Windows, macOS, and Linux, verify the installation, create your first program, and fix common installation problems.

✦ What Are Node.js and npm?

Node.js is a JavaScript runtime environment that allows JavaScript code to run outside a browser. Developers use it to create backend applications, APIs, web servers, and automation tools.

npm is the package manager commonly used with Node.js. It helps developers install third-party packages, manage dependencies, and maintain project configurations.

For example, Express.js is a popular Node.js framework that can be installed using npm.

npm install express

This command installs Express.js as a dependency in the current project when run in an appropriately initialized project folder.

✦ System Requirements Before Installation

Before installing Node.js, make sure your computer meets the basic requirements.

  • A supported version of Windows, macOS, or Linux.

  • An internet connection to download the installer or packages.

  • Permission to install software or use a package manager.

  • A terminal, such as Command Prompt, PowerShell, Terminal, or a Linux shell.

Visit the official website to download Node.js:

https://nodejs.org/

Choose a supported LTS (Long-Term Support) version for most learning and development projects. Check the official release information for current support status.

✦ How to Install Node.js on Windows

Follow these steps to install Node.js on Windows.

❖ Step 1: Download Node.js

Open your browser and visit:

https://nodejs.org/

Download the Windows installer for a supported LTS release. Choose the correct installer architecture for your computer.

❖ Step 2: Run the Installer

Open the downloaded installer and follow the setup wizard.

Accept the licence agreement, choose the installation location, and keep the standard options unless you have a specific reason to change them.

Make sure the option to add Node.js to the system PATH remains enabled.

Complete the installation.

❖ Step 3: Open Command Prompt

Press Windows + R, type cmd, and press Enter.

Alternatively, open PowerShell or the integrated terminal in your code editor.

❖ Step 4: Verify Node.js

Run:

node -v

Then check npm:

npm -v

Both commands should display version numbers if the installation is configured correctly.

❖ Step 5: Create Your First Node.js File

Create a folder named node-practice. Inside it, create a file called app.js.

Add this code:

console.log("Welcome to Node.js!");
console.log("Learning with Param Classes");

Open a terminal in the project folder and run:

node app.js

Expected output:

Welcome to Node.js!
Learning with Param Classes

You have now successfully executed a JavaScript program using Node.js.

✦ How to Install Node.js on macOS

There are multiple ways to install Node.js on macOS. Beginners can use the official installer or a version manager.

❖ Method 1: Official Installer

Step 1: Visit https://nodejs.org/.

Step 2: Download the supported macOS LTS installer suitable for your Mac.

Step 3: Open the downloaded package and follow the installation instructions.

Step 4: Open Terminal from Applications or Spotlight Search.

Verify the installation:

node -v
npm -v

If both commands return version numbers, the tools are available in your terminal.

❖ Method 2: Using Homebrew

If Homebrew is already installed, you can use it to install Node.js.

brew install node

Verify the installation:

node -v
npm -v

If you need to switch between different Node.js versions for different projects, consider using a Node.js version manager instead of relying on one system-wide installation.

✦ How to Install Node.js on Linux

Linux users can install Node.js through their distribution's package manager or an appropriate version manager.

The exact commands depend on your Linux distribution and repository configuration.

❖ Ubuntu and Debian

First, update the package information:

sudo apt update

Then install the available Node.js and npm packages:

sudo apt install nodejs npm

Verify the versions:

node -v
npm -v

Important: The versions supplied by the default repositories may not be the latest supported LTS versions. If your project requires a particular version, follow the official Node.js installation guidance for your distribution.

❖ Using a Version Manager

A Node.js version manager allows you to install and switch between multiple versions.

For example, nvm is a commonly used version manager. Follow its official installation instructions, then install a supported Node.js version using commands such as:

nvm install --lts
nvm use --lts

Check the official nvm documentation before installing it, and avoid mixing multiple installation methods without understanding how your PATH is configured.

✦ How to Check Whether Node.js Is Installed Correctly

After installation, run these commands:

node -v
npm -v

To check where the commands are located, use the appropriate command for your operating system.

Windows:

where node
where npm

macOS and Linux:

which node
which npm

If the commands return valid paths and version numbers, Node.js and npm are generally ready to use.

✦ Common Node.js Installation Problems

❖ 1. 'node' Is Not Recognized

On Windows, this error often means Node.js is not installed correctly or its installation directory is missing from PATH.

Restart the terminal after installation. If the problem continues, check the PATH environment variable and confirm the installation directory is included.

❖ 2. npm Command Not Found

Check whether npm was installed alongside Node.js and whether the relevant installation directory is accessible through PATH.

On Windows, rerunning the official installer may help repair the installation.

❖ 3. Permission Errors

On macOS and Linux, permission problems can occur when installing global npm packages or writing to protected directories.

Avoid using sudo for every npm command. Consider a version manager or a correctly configured npm global directory.

❖ 4. Incorrect Node.js Version

Some projects require a specific Node.js version. Check the project's documentation and use a suitable version manager if necessary.

❖ 5. Network or Download Problems

Check your internet connection and download Node.js only from trusted official sources. Corporate firewalls and proxy settings may also affect package downloads.

✦ What Should You Learn After Installing Node.js?

Once installation is complete, follow a structured learning path.

  1. JavaScript fundamentals.

  2. Node.js built-in modules.

  3. npm and package management.

  4. File handling and asynchronous programming.

  5. HTTP servers.

  6. Express.js and REST APIs.

  7. MySQL or MongoDB integration.

  8. Authentication and application security.

  9. Testing and deployment.

Param Classes recommends practising each topic with small programs before building complete backend projects.

✦ Frequently Asked Questions (FAQs)

1. Is npm installed automatically with Node.js?

The official Node.js installer normally includes npm. Verify both tools after installation.

2. Which Node.js version should beginners install?

A supported LTS version is generally a good starting point for learning and development.

3. Can I install Node.js on Windows 10 or Windows 11?

Check the current Node.js system requirements and support information to confirm compatibility with your specific Windows version.

4. Can I use Node.js without installing npm?

Node.js can run JavaScript without npm, but npm is useful for installing packages and managing dependencies.

5. Can I install multiple Node.js versions?

Yes. A version manager can help you install and switch between versions for different projects.

6. Where should I download Node.js?

Use the official website: https://nodejs.org/.

✦ Conclusion

Installing Node.js and npm is the first step towards backend JavaScript development. Whether you use Windows, macOS, or Linux, you can verify the installation through simple terminal commands and start running JavaScript programs immediately.

After installation, practise JavaScript, explore built-in Node.js modules, and gradually move towards Express.js, APIs, and database integration.

Param Classes helps learners build their programming knowledge through structured learning and practical development exercises.

Website: https://paramclasses.in/

←
Post 3 of 40
→