|
| 1 | +--- |
| 2 | +id: setup-nodejs |
| 3 | +title: Setting Up Node.js for Local Development |
| 4 | +sidebar_label: Node.js Setup |
| 5 | +description: A beginner's guide to installing and configuring Node.js on your local machine. |
| 6 | +slug: /NodeJS-Setup |
| 7 | +--- |
| 8 | + |
| 9 | +# Setting Up Node.js for Local Development |
| 10 | + |
| 11 | +## Introduction |
| 12 | +Node.js is a powerful JavaScript runtime that allows you to run JavaScript code outside of a web browser. It's essential for building modern web applications, APIs, and tools. In this tutorial, we'll walk through the steps to set up Node.js on your local machine. By the end, you'll have a working environment ready for development. |
| 13 | + |
| 14 | +This guide is aimed at beginners, so we'll cover everything from installation to verification. If you're new to programming, don't worry—we'll keep it simple! |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | +Before we begin, make sure you have: |
| 18 | +- A computer with internet access (Windows, macOS, or Linux). |
| 19 | +- Administrative privileges on your machine (to install software). |
| 20 | +- A code editor like VS Code (optional but recommended for writing code). |
| 21 | + |
| 22 | +Estimated time: 10-15 minutes. |
| 23 | + |
| 24 | +## Step-by-Step Guide |
| 25 | + |
| 26 | +### Step 1: Download Node.js |
| 27 | +1. Go to the official Node.js website at [nodejs.org](https://nodejs.org). |
| 28 | +2. On the homepage, you'll see two versions: LTS (Long Term Support, recommended for stability) and Current (for the latest features). |
| 29 | + - For beginners, choose the LTS version. |
| 30 | +3. Click on the "LTS" download button. This will automatically detect your operating system and provide the correct installer. |
| 31 | + |
| 32 | +### Step 2: Install Node.js |
| 33 | +The installation process varies slightly by operating system. Follow the instructions for your OS: |
| 34 | + |
| 35 | +- **Windows**: |
| 36 | + 1. Run the downloaded installer (e.g., `node-vXX.XX.X-x64.msi`). |
| 37 | + 2. Follow the wizard: Accept the license, choose the default installation options, and click "Install." |
| 38 | + 3. Once complete, click "Finish." |
| 39 | + |
| 40 | +- **macOS**: |
| 41 | + 1. Open the downloaded `.pkg` file. |
| 42 | + 2. Follow the installer prompts: Agree to the license and click "Continue" through the steps. |
| 43 | + 3. Enter your administrator password if prompted. |
| 44 | + 4. After installation, open a terminal to verify. |
| 45 | + |
| 46 | +- **Linux (e.g., Ubuntu)**: |
| 47 | + 1. Download the installer or use the package manager. For Ubuntu, open a terminal and run: |
| 48 | + ``` |
| 49 | + curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - |
| 50 | + sudo apt-get install -y nodejs |
| 51 | + ``` |
| 52 | + 2. If you downloaded the installer, extract it and follow the on-screen instructions. |
| 53 | +
|
| 54 | +### Step 3: Verify the Installation |
| 55 | +After installation, let's check if Node.js is working correctly: |
| 56 | +1. Open your terminal or command prompt. |
| 57 | +2. Type the following command and press Enter: |
0 commit comments