How to Install Node.js on Windows 11

Node.js is a popular JavaScript runtime that allows developers to build scalable applications. Installing Node.js on Windows 11 is simple and straightforward. This guide will walk you through the installation process and verify your setup.

YouTube Video

Step 1: Download Node.js Installer

  1. Visit the Official Node.js Website:
    Open your browser and go to https://nodejs.org/.

  2. Choose a Version:

    • LTS (Long-Term Support): Recommended for most users, especially for production environments.
    • Current: Includes the latest features but may not be as stable as the LTS version.
  3. Download the Windows Installer:
    Click the Windows Installer button for your chosen version. The file will be in .msi format (e.g., node-vxx.x.x-x64.msi).

Step 2: Run the Node.js Installer

  1. Locate the Installer:
    Navigate to your Downloads folder and find the downloaded file (e.g., node-vxx.x.x-x64.msi).

  2. Launch the Installer:
    Double-click the .msi file to start the setup wizard.

Step 3: Install Node.js

  1. Accept the License Agreement:

    • Read the terms and click I Accept to proceed.
  2. Choose an Installation Location:

    • Use the default location (C:\Program Files\nodejs) or specify a custom path.
    • Click Next.
  3. Select Components:

    • Keep all the default components selected:
      • Node.js runtime
      • npm package manager
      • Add to PATH (adds Node.js to your system's PATH environment variable).
    • Click Next.
  4. Install:

    • Click Install to start the installation process.
  5. Finish Setup:

    • After the installation is completed, click Finish to close the installer.

Step 4: Verify the Installation

  1. Open Command Prompt or PowerShell:

    • Press Win + R, type cmd or powershell, and press Enter.
  2. Check Node.js Version:

    • Run the following command:
      node -v
      
    • This displays the installed version of Node.js (e.g., v16.x.x).
  3. Check npm Version:

    • Run the following command:
      npm -v
      
    • This displays the installed version of npm (Node Package Manager).

Step 5: Test Node.js

  1. Create a Test Script:

    • Open Notepad or any text editor.
    • Write the following code:
      console.log("Node.js is working!");
      
    • Save the file as test.js in a folder of your choice.
  2. Run the Script:

    • Open Command Prompt or PowerShell and navigate to the folder containing test.js.
    • Run the script with the command:
      node test.js
      
    • You should see the output:
      Node.js is working!

Optional: Update npm (if needed)

After installation, you might want to update npm to the latest version:

  1. Run the following command:

    npm install -g npm@latest
    
  2. Verify the update:

    npm -v

Conclusion

You’ve successfully installed Node.js and npm on Windows 11. With this setup, you’re ready to develop and run JavaScript applications on your system. Explore Node.js libraries, build APIs, or create full-stack applications using tools like React, Angular, or Vue. Happy coding!

Comments