Build, run, and debug Node.js apps natively on WSL
Combine Linux performance with Windows tooling. This guide walks you through installing Node.js with modern version managers, configuring your editor, and shipping production-ready services from the WSL terminal.
- 1Prep your distro for Node.js with build-essential packages and shell tweaks.
- 2Install and switch between Node.js versions using nvm, fnm, or asdf.
- 3Wire up VS Code debugging, package managers, and test runners for a polished workflow.
Prefer a GUI? Pair this workflow with VS Code remote development or use WSLg for GPU-accelerated browser previews.
Prerequisites
Start with a healthy WSL distro (Ubuntu, Debian, Arch, etc.). Run these checks inside your WSL terminal before installing Node.js.
Verify WSL Distro
Confirm that your Linux distribution is running with WSL 2 for best Node.js performance.
wsl -l -vUpdate Packages
Refresh the package index and upgrade existing packages inside your distro.
sudo apt update && sudo apt upgradeInstall Build Essentials
Install required build tooling so native node modules compile correctly.
sudo apt install build-essential curl file gitInstall Node.js with a Version Manager
Avoid using the system node package. Version managers keep projects isolated and simplify upgrades.
nvm
The most popular Node.js version manager. Great when you need to switch between LTS releases.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bashCommon commands
- nvm install --lts
- nvm use --lts
- nvm install 22.11.0
fnm
Fast Node Manager written in Rust. Excellent performance with minimal shell init cost.
curl -fsSL https://fnm.vercel.app/install | bashCommon commands
- fnm env --use-on-cd >> ~/.bashrc
- fnm install latest
- fnm use 20
asdf
Polyglot version manager that can handle Node.js plus other runtimes from a single tool.
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.gitCommon commands
- asdf install nodejs latest
- asdf global nodejs 20.12.2
Tooling Recommendations
Package Managers
- npm ships with Node.js—great for simple scripts and smaller projects.
- pnpm uses content-addressable storage for faster installs across repos.
- Yarn 4 (Berry) improves monorepo workflows and zero-install environments.
Task Automation
- Use npm scripts for lightweight automation directly in package.json.
- Adopt turbo, Nx, or just-task if you orchestrate multi-package workspaces.
- Leverage VS Code tasks.json for shared dev/CI tasks accessible from the command palette.
Testing & Linting
- Vitest or Jest cover unit/integration testing with snapshot support.
- ESLint handles linting; pair with Prettier or Biome for formatting.
- Consider Playwright for full-stack browser automation on WSL.
Debugging Node.js in WSL
VS Code Debug Adapter
Install the "Node.js" debugger in VS Code, then use Run and Debug ➜ Node.js Launch to set breakpoints inside your WSL workspace.
Inspect CLI
Launch node with --inspect or --inspect-brk, then attach Chrome DevTools at chrome://inspect or the VS Code debugger.
pnpm + Turbo Logs
When commands run inside pnpm / turbo pipelines, stream logs with pnpm --reporter=append-only for deterministic CI output.
Further Reading
Bookmark these resources to stay current with the Node.js ecosystem while working inside WSL.
Official Node.js Docs
Release notes, API references, and LTS schedules maintained by the Node.js foundation.
NodeSource WSL Guide
APT repositories and installation scripts for keeping Node.js builds updated on Debian/Ubuntu.
Microsoft WSL Samples
Official walkthrough for combining WSL with VS Code, Node.js, and browser tools.
WSL Guide Development
Return to the broader WSL development guide for cross-language best practices.