Before you can run JavaScript on your machine you need two things — a JavaScript runtime and a code editor. The runtime is Node.js and the editor is VS Code. Both are free, both run on Windows, macOS, and Linux, and together they form the standard setup for almost every JavaScript developer and QA engineer in the industry. This lesson walks you through installing them, creating your first project folder, and running a real script end to end.
Why Node.js
Browsers can run JavaScript, but they can only run it inside a web page. To run JavaScript from a terminal — to execute a test file, run a build tool, or fire off a quick utility script — you need a runtime that exists outside the browser. That runtime is Node.js.
Node.js takes the V8 JavaScript engine (the same one inside Chrome) and wraps it so you can use it from a command line. It also adds the things scripts typically need — file system access, networking, package management — that browsers deliberately don't expose for security reasons.
Every modern QA tool you'll use (Cypress, Playwright, Jest, Mocha, npm itself) is a Node.js program under the hood. Installing Node.js installs the foundation those tools need.
Installing Node.js
- Visit https://nodejs.org.
- Two download buttons appear: LTS and Current. Pick LTS (Long-Term Support) — it's the stable, production-grade version. "Current" is bleeding-edge and meant for library authors, not learners.
- Run the installer. On Windows, accept the default "Add to PATH" option. On macOS, the installer handles everything.
- Open a terminal: Terminal on macOS or Linux, PowerShell or Command Prompt on Windows.
- Verify the install by running:
node --version
npm --versionYou should see two version numbers — for example v20.11.0 and 10.2.4. If you instead see "command not found," the PATH wasn't set up; reopen the terminal or restart the machine.
node is the JavaScript runtime. npm is the Node Package Manager — it ships with Node.js and is how you'll install testing libraries, automation frameworks, and any other dependency in later lessons.
Why VS Code
You can technically write JavaScript in any text editor — Notepad, TextEdit, Vim. In practice, VS Code is the editor almost every JavaScript developer and QA engineer uses, for three reasons:
- It's free and made by Microsoft. No licence, no subscription.
- It understands JavaScript out of the box. Type a function name and IntelliSense suggests its parameters and documentation as you type. For a beginner this is effectively a tutor that lives inside the editor.
- It has a built-in terminal. You don't need to switch between editor and terminal — both live in one window.
The full VS Code tools entry covers more advanced setup; what's below is the minimum for this course.
Installing VS Code
- Visit https://code.visualstudio.com.
- Download the installer for your OS.
- Run it and accept the defaults.
- Open VS Code once installed.
Three extensions worth installing
VS Code is good out of the box; with three extensions it's great. Open the Extensions tab (the icon that looks like four squares) and search for each:
- ESLint — flags common JavaScript mistakes as you type (a missing semicolon, an unused variable, an undefined name). It's the difference between finding a bug now and finding it when your test fails three days later.
- Prettier — auto-formats your code so it always looks consistent. Save the file and Prettier cleans up indentation, spacing, and quote style.
- Code Runner (optional) — lets you click a "Run" button at the top right of any
.jsfile instead of typingnode file.jsin the terminal. Convenient while learning; less useful in real projects.
The setup flow at a glance
Step 1 of 5
Install Node.js
Download the LTS version from nodejs.org. Verify with node --version and npm --version.
Your first end-to-end run
Time to put it all together. The exact commands depend on your OS but the flow is the same.
1. Create a project folder. In your terminal:
mkdir js-for-qa
cd js-for-qaThis makes a folder called js-for-qa and changes into it. Every script in this course will live here.
2. Open the folder in VS Code. Either type code . (the dot means "this folder") in the terminal, or open VS Code and choose File → Open Folder... and select the new directory.
3. Create a file. In VS Code's sidebar, click the New File icon and name it hello.js. The .js extension matters — VS Code uses it to enable JavaScript-specific help.
4. Write one line. Type:
console.log("Environment ready!");Save the file with Ctrl+S (or Cmd+S on macOS).
5. Open the integrated terminal. Press Ctrl+` (the backtick key, usually next to the 1 key). A terminal panel opens at the bottom of VS Code, already pointed at your project folder.
6. Run the file. Type:
node hello.jsYou should see:
Environment ready!
That's a complete cycle: edit, save, run. You'll do exactly this thousands of times over the next few years.
A slightly fancier first run
Once the basic line works, try a three-liner that uses values Node.js exposes for you:
console.log("Environment ready!");
console.log("Node version:", process.version);
console.log("Today is", new Date().toDateString());Output (yours will differ):
Environment ready!
Node version: v20.11.0
Today is Tue May 06 2026
process.version is a value Node.js exposes everywhere. new Date() is part of JavaScript itself. You'll meet both again — for now, the point is that your environment can produce real, dynamic output.
⚠️ Common mistakes
- Installing the "Current" version of Node.js instead of "LTS". "Current" includes the newest features but also the newest bugs and breaking changes. LTS is what virtually every workplace uses. If a tutorial demands a Current-only feature, you'll know — and can switch then.
- Confusing the file name with the path. Running
node hello.jsonly works if your terminal's current directory containshello.js. If you seeCannot find module, look at the prompt — it should show the project folder. Usecdto navigate there first. - Editing in one folder and running from another. A common beginner sequence: save
hello.json the Desktop, then open a terminal that defaults toC:\Users\You\(or~). The file isn't there. Either save the file in the directory the terminal is already in, orcdto where the file actually lives.
🎯 Practice task
End-to-end environment check. Should take 15-20 minutes including any installs.
-
Install Node.js (LTS) if you haven't already. Confirm
node --versionprints a version number in your terminal. -
Install VS Code. Open it.
-
Add the ESLint and Prettier extensions from the Extensions tab.
-
In your terminal create a project folder:
mkdir js-for-qa && cd js-for-qa. -
Open the folder in VS Code (
code .or File → Open Folder). -
Create a file
hello.jsand add three lines:console.log("Environment ready!"); console.log("Node version:", process.version); console.log("Today is", new Date().toDateString()); -
Save the file. Open the integrated terminal with **Ctrl+
** and runnode hello.js`. -
Confirm you see all three lines printed — including your installed Node version and today's date.
If anything fails, retrace the steps. A working dev environment is the prerequisite for the rest of this course; spending 30 minutes here saves hours of frustration later.