Node.js is a powerful and versatile runtime environment that allows developers to run JavaScript on the server-side. It has become a fundamental tool for building web applications, APIs, and other server-based solutions. In this article, we will walk you through the process of installing Node.js on various operating systems, ensuring you have the necessary setup to begin your journey into server-side JavaScript development.
Prerequisites
Before we dive into the installation process, make sure you have the following prerequisites:
A computer with an internet connection.
Basic knowledge of your operating system's command-line interface (CLI).
Installation on Windows
1. Download Node.js Installer
Visit the official Node.js website at nodejs.org.
You'll see two versions available for download: LTS (Long Term Support) and Current. For most users, the LTS version is recommended for stability.
Click on the LTS version to download the installer for Windows.
2. Run the Installer
Locate the downloaded installer and double-click to run it.
Follow the on-screen instructions in the installer wizard.
You can accept the default settings, but you may want to customize the installation directory or features according to your preferences.
3. Verify Installation
Open your command prompt or PowerShell.
To verify that Node.js and npm (Node Package Manager) are installed, run the following commands:
node -v
npm -v
- You should see the installed versions of Node.js and npm displayed in the terminal.
Installation on macOS
1. Using Homebrew (Recommended)
Open Terminal, which can be found in the Utilities folder within the Applications folder.
Install Homebrew if you don't already have it by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- Once Homebrew is installed, you can easily install Node.js and npm by running:
brew install node
2. Download Node.js Installer
Alternatively, you can download the macOS installer from nodejs.org.
Choose the LTS version for stability.
Run the downloaded package file and follow the installation instructions.
3. Verify Installation
- Open Terminal and run the following commands:
node -v
npm -v
- You should see the installed versions of Node.js and npm displayed in the terminal.
Installation on Linux (Ubuntu/Debian)
1. Using Package Manager
Open your terminal.
Update the package list to ensure you have the latest information about available packages:
sudo apt update
- Install Node.js and npm with the following command:
sudo apt install nodejs npm
2. Verify Installation
- To verify the installation, run:
node -v
npm -v
- You should see the installed versions of Node.js and npm displayed in the terminal.
Congratulations! You've successfully installed Node.js and npm on your operating system. You're now ready to start building server-side applications, APIs, and more using the power of Node.js and JavaScript. Happy coding!
Top comments (0)