This procedure walks you through installing Node.js, the program that runs JavaScript code on the machine. It covers Windows, macOS, and Linux.
π§° Prerequisites
None.
π Steps
-
Go to nodejs.org (external link).
-
Click Get Node.js.
-
Click the Windows Installer (.msi) button to download the installer.
-
Run the downloaded installer.
-
Follow the wizard, keeping the default options.
-
Click Finish when the installer is done.
π― Expected Outcome
-
Open the Command Prompt.
-
Type
node --versionand press Enter. -
Type
npm --versionand press Enter. -
If both print a version number, Node.js is installed correctly. npm is installed with it.
β οΈ Mistakes
Skipping Add to PATH on Windows
If the installer’s PATH option is unchecked, typing node or npm in the terminal fails with a “not recognized” error. Run the installer again and make sure the PATH box is checked before finishing.
Not opening a fresh terminal after installing
A terminal reads the system configuration when it starts, so a terminal that was already open will not find a newly installed Node.js. Close any open terminal and open a new one, or restart VS Code, before checking the version.
Looking for a separate npm installer
npm is installed together with Node.js. There is nothing extra to download. If npm is not found, the cause is Node.js not being installed or not on the PATH, not a missing npm.
π Resources
- Node.js downloads (external link), official site
- About Node.js (external link), official guide