Have you ever wondered how massive modern platforms like Netflix, PayPal, and LinkedIn handle millions of users simultaneously without crashing? The secret weapon behind much of the modern web is Node.js.
Traditionally, JavaScript—the language that makes websites interactive—could only run inside a web browser like Chrome or Edge. Node.js changed the game by freeing JavaScript from the browser, allowing it to run directly on your computer. This means you can use it to build backend servers, automate boring computer tasks, or run powerful development tools.
If you are intimidated by coding, don't worry. This guide will take you from zero to running your very first Node.js program on Windows, step-by-step.
Prerequisites
Before we begin, you only need two things:
A computer running Windows 10 or 11.
An active internet connection to download the installer.
No prior coding experience or command-line knowledge is required!
Step-by-Step Instructions
- Download the Node.js Installer First, we need to grab the official installation file.
Open your web browser and go to the official website: nodejs.org.
You will see two primary options to download. Always choose the LTS (Long Term Support) version. The LTS version is heavily tested, stable, and less likely to give you unexpected errors.
Click the Windows Installer button to download the .msi file to your computer.
- Run the Setup Wizard Once the download finishes, navigate to your Downloads folder and double-click the file to open the setup wizard.
Click Next on the welcome screen.
Accept the license agreement and click Next.
Leave the default installation folder as it is (C:\Program Files\nodejs) and click Next.
On the "Custom Setup" screen, leave everything at its default and click Next.
Important Step: You will see a checkbox that asks to "Automatically install the necessary tools." Leave this unchecked for now to keep your setup simple and fast. Click Next.
Finally, click Install. If Windows asks for permission to make changes, click Yes.
Once completed, click Finish.
- Verify the Installation via Command Line Now, we need to make sure your computer successfully recognizes Node.js. To do this, we will use the Windows Command Prompt.
Press the Windows Key on your keyboard, type cmd, and press Enter. A black text window will appear.
To check if Node.js is installed, type the following command and press Enter:
node -v
If successful, you will see a version number printed out (for example, v20.11.0 or similar).
Node.js automatically installs a companion tool called npm (Node Package Manager), which lets you download extra coding tools. Let's verify that too. Type this command and press Enter:
npm -v
You should see another version number. If you see both numbers, Node.js is officially ready to roll!
- Write and Run Your First Script Let's build a tiny program to see Node.js in action.
Open the standard Windows Notepad app.
Type the following line of code exactly as shown:
console.log("Success! Node.js is working on my computer.");
Click File > Save As.
Change the "Save as type" dropdown to All Files (.).
Name the file app.js and save it directly to your Desktop.
Go back to your Command Prompt window. Type this command to tell your terminal to look at your Desktop folder, then press Enter:
cd Desktop
Now, tell Node.js to execute your script by typing:
node app.js
Press Enter. You will see Success! Node.js is working on my computer. printed directly into your terminal.
Troubleshooting / Common Errors
" 'node' is not recognized as an internal or external command "
This is the most common error beginners face. It means Windows can't find where Node.js was installed.
**The Fix: **Simply close your Command Prompt window and open a brand-new one. Windows needs to refresh its settings to notice the newly installed program. If that fails, restart your PC.
Commands freeze or don't respond
If you type a command and nothing happens, check your spelling.
The Fix: Commands are case-sensitive and spacing matters. Ensure there is a space between node and -v, and that you aren't capitalizing anything.
Conclusion
Congratulations! You just stepped into the world of backend development. By installing Node.js and running your first script via the command line, you’ve conquered the environment setup hurdle that stops many aspiring developers. From here, you can start exploring how to build local automated scripts, web servers, or dive deeper into JavaScript programming.
Top comments (0)