DEV Community

karoon sillapapan
karoon sillapapan

Posted on

Installing NVM on Windows (WSL - Ubuntu)

πŸš€ Installing NVM on Windows (WSL - Ubuntu)

Follow these steps to install Node Version Manager (NVM) inside your WSL Ubuntu environment.

βœ… Prerequisites

  • WSL2 with Ubuntu installed
  • Internet connection

πŸ›  Installation Steps

# 1. Download and run the NVM install script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# 2. Load NVM into the current shell session
source ~/.bashrc

# 3. Verify NVM is installed
nvm --version

# 4. Install the latest LTS version of Node.js
nvm install --lts

# 5. Set it as the default version
nvm alias default lts/*
Enter fullscreen mode Exit fullscreen mode

πŸ“¦ Verify Installation

# Check Node.js version
node -v

# Check npm version  
npm -v
Enter fullscreen mode Exit fullscreen mode

You're now ready to manage Node.js versions in your WSL environment using NVM!

πŸ”„ Common NVM Commands

# List all available Node.js versions
nvm ls-remote

# Install a specific version
nvm install 16.14.0

# Switch to a specific version
nvm use 16.14.0

# List installed versions
nvm ls

# Set default Node.js version
nvm alias default 16.14.0
Enter fullscreen mode Exit fullscreen mode

πŸ“˜ Additional Resources

Top comments (0)