To install Node.js, follow these steps based on your operating system:
For Windows:
-
Download the Installer:
- Go to the Node.js official website.
- Download the Windows installer (LTS version is recommended).
-
Run the Installer:
- Open the downloaded
.msifile. - Follow the installation prompts, accepting the license agreement and choosing the installation path.
- Open the downloaded
-
Verify Installation:
- Open Command Prompt and run:
node -v - This should display the installed Node.js version.
- Open Command Prompt and run:
For macOS:
-
Using Homebrew (recommended):
- Open Terminal.
- Install Homebrew if you haven't already:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Install Node.js:
brew install node
-
Verify Installation:
- Run the following command in Terminal:
node -v
- Run the following command in Terminal:
For Linux:
-
Using Package Manager:
-
For Ubuntu/Debian:
sudo apt update sudo apt install nodejs npm -
For CentOS/RHEL:
sudo yum install nodejs npm
-
-
Verify Installation:
- Run the following command in Terminal:
node -v
- Run the following command in Terminal:
Additional Step (Optional):
- You can also use Node Version Manager (nvm) to install Node.js, which allows you to manage multiple versions easily. Follow the instructions on the nvm GitHub page for installation.
If you have any questions or need further assistance, feel free to ask!
