Install Node.js
Installing Node.js is a five-minute job. Go to nodejs.org and you will see a big green button with the latest version number. Click it to download the installer for your operating system. The site also offers two versions: LTS and Current. Choose LTS. It stands for Long Term Support and gets years of maintenance, while Current gets newer features but changes faster. For learning, LTS is the stable choice.
Windows users get an .msi file. Double-click it and press Next until it finishes. One checkbox matters: Add to PATH. Leave it on. PATH is the list of folders your terminal searches when you type a command. With Node.js on PATH, typing node works in any folder. Mac users get a .pkg file. Open it and follow the steps. Linux users usually run a package manager command, which differs by distribution, so check the official docs for yours.
After the installer finishes, test it. Open a fresh terminal and type node --version. You should see something like v20.11.0. Then type npm --version, since npm is installed together with Node.js. If both print numbers, you are ready. If the terminal says node is not recognized, do not panic. Close the terminal and open a new one, because an old window does not pick up a new PATH. Still failing? Reinstall and keep the defaults.
Check your installation
Open a terminal and run these two commands. They are the fastest way to confirm the install worked. The version numbers do not need to match anything. Any recent version is fine for this course, and if npm prints a number too, both halves of the install are in place.
node --version
npm --version
Node js install on Windows
The most common questions come from Windows users. Download the LTS installer from nodejs.org and run the .msi file, keeping every default. The Add to PATH checkbox is what lets you type node in any terminal. When the install finishes, close the terminal and open a new one so it reads the updated PATH. You can confirm the setup with where node.
where node
Fix a command not found error
If the terminal says node is not recognized, PATH is the usual suspect. On Windows, reinstalling with the defaults normally fixes it. On Mac and Linux, close the terminal and open a new one first, because the shell reads PATH when it starts. If that does not help, reinstall Node.js and restart the terminal again before trying anything else.
node --version
Syntax
node --version
npm --version
nvm Beats System Node for Version Switching
Use nvm (Node Version Manager) to switch versions — system Node causes permission errors.
nvm install 20; nvm use 20
Good to know
- Choose the LTS version on nodejs.org.
- Keep Add to PATH enabled on Windows.
- Open a new terminal after installing.
- npm is installed at the same time as Node.js.