Introduction
Setup Your Environment
Before writing any code, you need two things: a code editor and a JavaScript runtime. This guide walks you through installing VS Code and Node.js inside your WSL environment.
Complete WSL setup first
This guide assumes you have WSL installed and running. If you haven't done that yet, start with Install WSL on Windows first.
Install VS Code
VS Code is a free, lightweight code editor made by Microsoft. It has built-in WSL support, which means you can edit your Linux files directly from Windows — no file path juggling required.
1. Download and install VS Code on Windows
Go to code.visualstudio.com and download the Windows installer. Run it and follow the prompts.
During installation, make sure "Add to PATH" is checked — this lets you open VS Code from the terminal with the code command.
2. Install the WSL extension
Open VS Code, go to the Extensions panel (Ctrl + Shift + X), and search for WSL (published by Microsoft). Install it.
This extension lets VS Code connect directly to your WSL filesystem and run tools like Node.js from inside Linux.
3. Open VS Code from your WSL terminal
Inside your WSL terminal, navigate to any folder and run:
code .
VS Code will open on Windows but connected to your WSL environment. You'll see "WSL: Ubuntu" in the bottom-left corner — that means it's working.
Always open projects with `code .`
Launching VS Code from WSL ensures that the built-in terminal, extensions, and file paths all use Linux. If you open VS Code by double-clicking on Windows, it won't have access to your WSL tools.
Recommended VS Code extensions
Once VS Code is connected to WSL, install these extensions inside the WSL context (VS Code will prompt you to install them "in WSL"):
| Extension | What it does |
|---|---|
| ESLint | Highlights JavaScript errors as you type |
| Prettier | Auto-formats your code on save |
| GitLens | Adds Git blame, history, and diff tools |
| Error Lens | Shows error messages inline next to the code |
To install them, open the Extensions panel (Ctrl + Shift + X) and search by name while VS Code is connected to WSL.
Install Node.js
Node.js lets you run JavaScript outside the browser — on the server, in scripts, and in build tools. You'll use it constantly as a full-stack developer.
The best way to install Node.js on Linux is through nvm (Node Version Manager). nvm lets you install multiple versions of Node and switch between them easily.
1. Install nvm
Inside your WSL terminal, run:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
When it finishes, close and reopen your terminal so the nvm command becomes available.
2. Verify nvm is installed
nvm --version
You should see a version number like 0.40.3. If you get "command not found", close and reopen your terminal and try again.
3. Install the latest LTS version of Node.js
LTS stands for Long-Term Support — it's the stable version recommended for most projects.
nvm install --lts
4. Verify Node.js and npm are installed
node --version
npm --version
You should see something like:
v22.14.0
10.9.2
Both commands working means Node.js is installed correctly. npm (Node Package Manager) is bundled with Node and is what you'll use to install libraries and run scripts.
Test everything works together
Let's make sure VS Code, Node.js, and WSL are all talking to each other correctly.
1. Create a test project
In your WSL terminal:
mkdir ~/hello-world
cd ~/hello-world
code .
VS Code should open, connected to WSL, showing your hello-world folder.
2. Create a JavaScript file
In VS Code, create a new file called index.js and add:
const message = 'Hello from Node.js!'
console.log(message)
3. Run it in the VS Code terminal
Open the built-in terminal in VS Code with Ctrl + ` and run:
node index.js
You should see:
Hello from Node.js!
If that prints, your environment is fully set up and ready to go.
Next steps
You now have a professional development environment running on Windows. Move on to How the web works to start learning web fundamentals.