Install Node

Installing Node.js and npm on Windows 11 using a Node Version Manager (nvm-windows) is straightforward. Follow these steps:


Step 1: Download and Install nvm-windows

  1. Download the nvm-windows installer: Visit the official nvm-windows releases page and download the latest nvm-setup.zip.
  2. Run the Installer:
    • Extract the downloaded zip file.
    • Run the nvm-setup.exe file and follow the installation prompts.
    • During installation, you can choose the directory where nvm and Node.js versions will be installed.
  3. Verify nvm installation: Open Command Prompt or PowerShell and run: nvm version You should see the installed nvm version.

Step 2: Use nvm-windows to Install Node.js and npm

  1. List available Node.js versions: nvm list available
  2. Install the latest LTS version of Node.js: nvm install lts
  3. Set the default Node.js version: nvm use lts
  4. Verify installation: node --version npm --version

Step 3: Update npm to the Latest Version

To update npm to the latest version globally, run:

npm install -g npm

Step 4: Test Your Installation

  1. Create a simple Node.js project: mkdir test-node cd test-node npm init -y
  2. Install a package (e.g., Express): npm install express
  3. Verify the installation: Check the node_modules directory and package.json file for the installed package.

Common Issues and Fixes

  1. nvm Not Recognized:
    • Ensure the nvm path is added to your environment variables:
      • Press Win + S, type Environment Variables, and open it.
      • Add the path to nvm (e.g., C:\Program Files\nvm) and the path to Node.js (e.g., C:\Program Files\nvm\vX.X.X) to the Path variable.
  2. Permission Issues:
    • Always run your terminal as an Administrator to avoid permission problems.
  3. Switching Node.js Versions: You can install and switch between multiple Node.js versions using: nvm install <version> nvm use <version>

Now, you’re ready to use Node.js and npm on Windows 11! Let me know if you encounter any challenges.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top