A good setup saves hours later. This lesson lists exactly what to install, why, and how to check that it works. Nothing here is difficult, but small mistakes, such as an old version of Node.js, cause confusing errors later, so it is worth ten careful minutes now.
What you need
- Node.js 20 or newer (the current LTS version is the safest choice). It runs your server and also the tools that build the React app. Download it from nodejs.org. It includes npm, the package manager.
- A code editor. Visual Studio Code is free and works well, but any editor is fine. Useful extensions: ESLint, Prettier and REST Client (we use it in lesson 13).
- Git, to save versions of your work and to deploy at the end. Install it from git-scm.com.
- A modern browser with developer tools: Chrome, Edge or Firefox. Press F12 to open them. You will use the Network and Console tabs often.
- A MongoDB database (lesson 14 shows both options: a free cloud database on Atlas, or MongoDB Community Edition on your computer). You do not need it yet.
Check your installation with a script
Instead of typing three commands and reading three outputs, run the small script from the lab. It asks your computer for the versions of Node.js, npm and Git, and tells you what to fix.
// Lesson 2: check that your computer is ready. Run: node examples/02-setup/check-setup.js
import { execSync } from 'node:child_process';
const major = Number(process.versions.node.split('.')[0]);
const tools = [
{ name: 'Node.js', check: () => `v${process.versions.node}`, ok: () => major >= 20, help: 'Install the LTS version from nodejs.org' },
{ name: 'npm', check: () => execSync('npm -v').toString().trim(), ok: () => true, help: 'npm comes with Node.js' },
{ name: 'Git', check: () => execSync('git --version').toString().trim(), ok: () => true, help: 'Install Git from git-scm.com' },
];
let allGood = true;
for (const t of tools) {
try {
const version = t.check();
const good = t.ok();
if (!good) allGood = false;
console.log(`${good ? 'OK ' : 'UPGRADE'} ${t.name}: ${version}${good ? '' : ' -> ' + t.help}`);
} catch {
allGood = false;
console.log(`MISSING ${t.name} -> ${t.help}`);
}
}
console.log(allGood ? '\nYou are ready for lesson 3.' : '\nFix the lines above, then run this again.');
Notice what the script does: process.versions.node is information Node.js gives about itself, and execSync('npm -v') runs a command exactly as if you had typed it in the terminal. You will use both ideas again.
Using the terminal
You will type commands in a terminal for most of this course. On Windows use PowerShell or the terminal inside VS Code; on macOS and Linux use Terminal. The few commands you need on day one:
cd folder-namemoves into a folder, andcd ..moves up one level.ls(macOS and Linux) ordir(Windows) lists the files in the current folder.node file.jsruns a JavaScript file.npm installdownloads the packages listed inpackage.jsoninto anode_modulesfolder.- Ctrl + C stops a running program. You will use this every day.
Folder habits that help
Keep the project in a folder whose path has no spaces or special characters, for example C:\projects\mern-job-tracker or ~/projects/mern-job-tracker. Unzip each lesson's solution into a new folder rather than over your own work, so you can compare the two with your editor's “compare files” tool. When you are not sure why your code behaves differently from the lesson, comparing against the zip is the fastest way to find the one line that differs.
Your task
- Install Node.js (LTS), Git and VS Code.
- Unzip this lesson's solution and run
node examples/02-setup/check-setup.js. - Fix every line that says
UPGRADEorMISSING, then run it again until it says you are ready. - Run
git config --global user.name "Your Name"andgit config --global user.email "you@example.com"so your commits carry your name.
How to check it worked
- Each tool shows
OKand the script ends with “You are ready for lesson 3.” node -vprints v20 or higher.
Summary
- You need Node.js 20+, an editor, Git and a browser. MongoDB comes in lesson 14.
- The terminal runs your programs; Ctrl + C stops them.
- Keep secrets and
node_modulesout of Git.