codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
🟢

Node.js

2 / 63 topics
1Getting Started with Node.js2Node.js Installation3Hello World Program4Node.js Modules5Node Package Manager (NPM)
Tutorials/Node.js/Node.js Installation
🟢Node.js

Node.js Installation

Updated 2026-04-20
4 min read

Node.js Installation

Node.js is a powerful, open-source JavaScript runtime environment that allows developers to execute JavaScript code outside of web browsers. It's widely used for building server-side applications, real-time web applications, and command-line tools. This tutorial will guide you through the process of installing Node.js on various operating systems, including Windows, macOS, and Linux.

Prerequisites

Before proceeding with the installation, ensure that your system meets the following requirements:

  • Operating System: Windows 7 or later, macOS 10.12 (Sierra) or later, or any modern Linux distribution.
  • Internet Connection: A stable internet connection is required to download Node.js and its dependencies.

Installation Steps

1. Downloading Node.js

Node.js can be installed in several ways, including using the official installer, package managers, or version management tools. Below are the steps for each method.

a. Using the Official Installer

The easiest way to install Node.js is by downloading the official installer from the Node.js website.

  1. Visit the Node.js Website: Open your web browser and go to https://nodejs.org/.
  2. Choose a Version: You will see two versions available: LTS (Long Term Support) and Current. The LTS version is recommended for production environments, while the Current version includes the latest features.
  3. Download the Installer: Click on the download button for your operating system.

b. Using Package Managers

Package managers are software tools that help automate the installation and management of software packages.

i. On macOS (using Homebrew)

Homebrew is a popular package manager for macOS. If you don't have Homebrew installed, follow these steps:

  1. Install Homebrew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Install Node.js using Homebrew:

    brew install node
    
ii. On Linux (using Package Managers)

Most Linux distributions come with package managers like apt for Ubuntu, yum for CentOS, or dnf for Fedora.

  1. Using apt (Ubuntu):

    sudo apt update
    sudo apt install nodejs npm
    
  2. Using yum (CentOS):

    sudo yum install epel-release
    sudo yum install nodejs npm
    
  3. Using dnf (Fedora):

    sudo dnf module enable nodejs:14
    sudo dnf install nodejs
    

c. Using Version Management Tools

Version management tools like nvm (Node Version Manager) allow you to easily switch between different versions of Node.js.

i. Installing nvm on macOS/Linux
  1. Install nvm:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
  2. Load nvm: Add the following lines to your shell configuration file (e.g., .bashrc, .zshrc):

    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    
  3. Install Node.js using nvm:

    nvm install node  # Installs the latest version
    nvm install --lts  # Installs the LTS version
    
ii. Installing nvm on Windows

For Windows, you can use nvm-windows, a port of nvm for Windows.

  1. Download and Install nvm-windows:

    • Visit https://github.com/coreybutler/nvm-windows/releases and download the latest installer.
    • Run the installer and follow the on-screen instructions.
  2. Install Node.js using nvm-windows:

    nvm install latest  # Installs the latest version
    nvm install lts  # Installs the LTS version
    

2. Verifying the Installation

After installation, verify that Node.js and npm (Node Package Manager) are correctly installed by running the following commands in your terminal or command prompt:

node -v
npm -v

These commands should display the installed versions of Node.js and npm, respectively.

3. Setting Up Environment Variables

On Windows, you might need to set up environment variables to ensure that Node.js is accessible from any location in your command prompt.

  1. Open System Properties:

    • Right-click on This PC or Computer on the desktop or in File Explorer.
    • Select Properties.
    • Click on Advanced system settings.
  2. Environment Variables:

    • In the System Properties window, click on the Environment Variables button.
    • Under System variables, find and select the Path variable, then click Edit.
    • Add the path to your Node.js installation directory (e.g., C:\Program Files\nodejs).

4. Installing Additional Tools

To enhance your development experience, consider installing additional tools like:

  • Visual Studio Code: A lightweight but powerful code editor with excellent support for JavaScript and Node.js.
  • Git: A version control system essential for managing your codebase.

a. Installing Visual Studio Code

  1. Download and Install:

    • Visit https://code.visualstudio.com/ and download the installer for your operating system.
    • Run the installer and follow the on-screen instructions.
  2. Install Extensions:

    • Open Visual Studio Code.
    • Go to Extensions (Ctrl+Shift+X) and search for popular extensions like "ESLint", "Prettier", and "Node.js Extension Pack".

b. Installing Git

  1. Download and Install:

    • Visit https://git-scm.com/ and download the installer for your operating system.
    • Run the installer and follow the on-screen instructions.
  2. Configure Git:

    git config --global user.name "Your Name"
    git config --global user.email "your.email@example.com"
    

Best Practices

  • Use Version Management Tools: Always use tools like nvm to manage different versions of Node.js, especially in development environments.
  • Keep Node.js Updated: Regularly update Node.js to the latest LTS version to benefit from security patches and new features.
  • Use a Code Editor with Extensions: Utilize code editors like Visual Studio Code with relevant extensions to improve productivity and code quality.
  • Version Control Your Code: Use Git or other version control systems to manage your codebase effectively.

Conclusion

Installing Node.js is the first step in setting up a development environment for building server-side applications. By following this comprehensive guide, you should have Node.js installed and ready to use on your system. Whether you're using the official installer, package managers, or version management tools, the process is straightforward and can be tailored to fit your specific needs.

Happy coding!


PreviousGetting Started with Node.jsNext Hello World Program

Recommended Gear

Getting Started with Node.jsHello World Program