How to Install Node.js
Introduction
Node.js is a powerful JavaScript runtime that allows you to run JavaScript outside the browser. It’s used for building servers, tools, APIs, and full-stack applications. This guide will help you install Node.js on Windows, macOS, or Linux.
Step 1: Download Node.js
Visit the official Node.js website:
You will see two versions:
- LTS (Recommended) — Stable and ideal for most users.
- Current — Latest features, updated more often.
Select the installer for your operating system:
- Windows (.msi installer)
- macOS (.pkg installer)
- Linux (.deb or .rpm package)
Step 2: Install Node.js
Windows
- Run the .msi installer.
- Accept the license agreement.
- Keep default settings.
- Finish installation.
macOS
- Open the .pkg installer.
- Follow the installation steps.
- Node.js will be added to your system automatically.
Linux
- Download the .deb or .rpm file.
- Install using your package manager.
- Node.js will appear in your applications menu.
Step 3: Verify Installation
Open your terminal and type:
node --version
npm --version
If Node.js is installed correctly, both commands will show version numbers. NPM (Node Package Manager) is included automatically.
Step 4: Install a Package
To test NPM, install a simple package:
npm install -g cowsay
Then run:
cowsay Hello Node.js!
You should see a fun ASCII cow message — this confirms everything works.
Troubleshooting
- If
nodeisn’t recognised, restart your computer. - On Windows, ensure the installer added Node.js to PATH.
- On macOS, allow the installer through security settings if needed.
- On Linux, update your package manager before installing.
Conclusion
Node.js is an essential tool for modern development. With it installed, you can build servers, tools, scripts, and full applications using JavaScript.
You’re now ready to explore Node.js packages, frameworks, and powerful development tools.