Node.js Get Started: Install, Setup & Run Your First App (2026–27)
By Pramod Behera · Updated: July 2026 · 16 min read
Node.js Get Started: Install, Setup & Run Your First App (2026–27)

By Pramod Behera · Updated: July 2026 · 16 min read
✅ In this Web Technologies Tutorial — Node.js Get Started: How To Install, Set Up And Run Your First App
This guide picks up right where our Node.js Introduction left off. If you already understand what Node.js is and why it exists, the next step is getting it running on your own machine. In this tutorial we walk through installing Node.js on Windows, macOS and Linux, verifying the installation, choosing between LTS and Current, setting up a code editor, exploring the interactive REPL, creating your first package.json, installing packages with npm, building a tiny web server, and avoiding the mistakes most beginners make. This tutorial finishes with a getting-started checklist, an interactive code playground, a quiz, and an FAQ.
✅ What You’ll Need Before You Start
Getting started with Node.js does not require any special hardware or paid software. Almost any modern computer running Windows, macOS, or Linux is enough. Before you begin, it helps to have the following ready:
- A computer with an up-to-date operating system and at least a few hundred megabytes of free disk space.
- Basic comfort using a terminal or command prompt — you don’t need to be an expert, just able to type and run a command.
- Some familiarity with JavaScript fundamentals, such as variables, functions, and console output.
- An internet connection for the initial download and for installing packages later.
ℹ️ Quick definition: “Getting started” with Node.js really means three things — installing the Node.js runtime on your machine, confirming it works, and running your first piece of JavaScript through it. Everything else in this guide builds on those three steps.
✅ Installing Node.js (Windows, macOS, Linux)
Node.js provides official installers for every major operating system, and the process takes only a few minutes on any of them.
🪟 Windows
Go to nodejs.org, download the Windows Installer (.msi) for the LTS version, and run it. Accept the default options — this also adds Node.js and npm to your system PATH automatically, so both commands work from any Command Prompt or PowerShell window.
🍎 macOS
Download the macOS Installer (.pkg) from nodejs.org and run it like any other application installer. Alternatively, if you use Homebrew, you can install Node.js with a single terminal command: brew install node.
🐧 Linux
Most Linux distributions offer Node.js through their package manager, though the bundled version can be older. For a current LTS release, use your distribution’s NodeSource setup script, or a version manager such as nvm, which many Linux developers prefer.
💡 Tip: If you expect to work on multiple projects that need different Node.js versions, install nvm (Node Version Manager) instead of installing Node.js directly. It lets you switch versions per project with a single command and avoids permission issues that sometimes come with system-wide installs.
✅ Verifying Your Installation
Once the installer finishes, open a terminal (Command Prompt, PowerShell, Terminal, or your Linux shell) and run the following two commands:
Also If both commands print a version number — something like v22.14.0 and 10.9.2 - your installation succeeded and Node.js is ready to use. If you instead see a "command not found" or "not recognized" error, the most common fix is to close and reopen your terminal so it picks up the updated PATH, or to restart your computer if that doesn't help.
⚠️ Common pitfall: Installing Node.js while a terminal window is already open will not update that window’s PATH automatically. Always open a fresh terminal window before verifying the installation.
✅ Choosing LTS vs. Current
The Node.js download page usually offers two options, and it’s worth understanding the difference before you pick one.


LTS (Long Term Support)
Beginners, learning projects, and production applications. Receives stability and security updates for years.

Current
Developers who want to try the newest JavaScript and Node.js features early, accepting that changes happen more often.
Unless you have a specific reason to need a brand-new feature, choose LTS. Almost every tutorial, package, and production deployment guide assumes you are running an LTS release, so it minimizes the chance of running into confusing compatibility issues while you are still learning.
✅ Setting Up a Code Editor
Node.js code can technically be written in any plain text editor, but a proper code editor makes learning far smoother. Visual Studio Code (VS Code) is the most widely used option in the Node.js community and is free to download.
Once installed, open your project’s folder in VS Code using File → Open Folder, then use the built-in terminal ( Terminal → New Terminal) to run the same node and npm commands you would use in a standalone terminal window.
✅ Your First Node.js Script
With Node.js installed and verified, it’s time to run actual code. Create a new folder for your project, then inside it create a file named app.js with the following content:
console.log("Hello, Node.js!");
Open a terminal inside that same folder and run:
You should immediately see Hello, Node.js! printed in the terminal. That's it - you've just executed JavaScript entirely outside of a web browser, which is the whole point of Node.js.
✅ Using the Node.js REPL
Besides running saved files, Node.js ships with an interactive prompt called the REPL (Read-Eval-Print Loop). It’s useful for quickly testing a line of JavaScript without creating a file at all. Start it by typing node with no filename:
node > 2 + 2 4 > const name = "Node.js learner"; undefined > console.log(`Hi, ${name}!`); Hi, Node.js learner!
Each line you type is read, evaluated, and the result is printed immediately — hence “Read-Eval-Print Loop.” To exit the REPL, press Ctrl + C twice, or type .exit and press Enter.
💡 Tip: The REPL is great for quick experiments — checking how a method behaves, testing a regular expression, or confirming syntax — but real projects should always live in saved .js files, not in REPL history.
✅ Creating Your First Project
A real Node.js project starts with a package.json file, which acts as its manifest. Inside your project folder, run:
The -y flag accepts all the default answers instantly. Without it, npm init asks you a series of questions - project name, version, description, entry point, and so on - and writes your answers into the same file. Either way, you'll end up with something like this:
From this point on, every package you install and every custom script you define will be recorded automatically inside this file, which makes it easy for anyone else — or a future version of you — to recreate the exact same project setup.
✅ Installing And Using npm Packages
npm, installed automatically with Node.js, gives you access to well over a million open-source packages. Installing one is a single command:
npm install express
This downloads the Express.js framework into a local node_modules folder and adds it as a dependency inside package.json. Once installed, you can import and use it in your code:
const express = require('express'); const app = express(); app.get('/', (req, res) => { res.send('Hello from Express!'); }); app.listen(3000, () => { console.log('App listening on port 3000'); });
⚠️ Important: The node_modules folder can grow to thousands of files even for small projects. It should never be committed to version control - add it to a .gitignore file instead. Anyone who clones your project can recreate it instantly by running npm install, since package.json already lists every dependency.
✅ Building a Simple Web Server
You do nit even need a third-party framework to build a working web server — Node.js includes a built-in http module for exactly this purpose:
const http = require('http'); const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello from my first Node.js server!'); }); server.listen(3000, () => { console.log('Server running at http://localhost:3000/'); });
Save this as server.js, run node server.js, then open a browser and go to http://localhost:3000/. You should see the plain text response rendered on the page. Press Ctrl + C in the terminal whenever you want to stop the server.
✅ Environment Variables And Configuration
Real applications need configuration that changes between your laptop and a live server — things like port numbers, database URLs, or API keys. Node.js exposes these through process.env:
const port = process.env.PORT || 3000; console.log(`Server will run on port ${port}`);
You can set a variable temporarily before running a command — for example, PORT=4000 node server.js on macOS and Linux - or store them in a local .env file loaded by a package such as dotenv. Either approach keeps sensitive values, like API keys, out of your source code.
ℹ️ Why this matters early: Getting comfortable with process.env now saves confusion later, since almost every real deployment platform configures apps through environment variables rather than hard-coded values.
✅ Debugging a Node.js App
When something goes wrong, Node.js gives you a few beginner-friendly ways to find out why, without installing anything extra.
🖨️ console.log Debugging
The simplest technique: print variable values at key points in your code to see what’s actually happening at runtime.
🐞 The Built-In Inspector
Run node --inspect app.js, then open chrome://inspect in Chrome to set breakpoints and step through code visually.
🧩 VS Code Debugger
VS Code has a built-in Node.js debugger — click to the left of a line number to set a breakpoint, then press F5 to run your file with debugging attached.
Reading the error message and stack trace carefully is often the fastest fix of all: Node.js errors usually point to the exact file and line number where something failed, along with a description of what went wrong.
✅ Recommended Project Structure
Even a small Node.js project benefits from a little organization from day one. A simple, common layout looks like this:
my-first-node-app/ ├── node_modules/ ├── src/ │ └── app.js ├── .env ├── .gitignore ├── package.json └── package-lock.json
You don’t need this exact structure for a one-file experiment, but adopting it early — especially the .gitignore file - builds habits that carry directly into larger, real-world projects.
✅ Common Beginner Mistakes
- Forgetting to run
npm installafter cloning a project, then wondering whyrequire()calls fail. - Committing
node_modulesto Git, which bloats repositories unnecessarily - use a.gitignorefile instead. - Mixing up global and local installs — running
npm install -gfor packages that should really be project dependencies. - Editing files inside
node_modulesdirectly - any changes are lost the next time packages are reinstalled. - Not restarting the terminal after installing Node.js, leading to confusing “command not found” errors.
- Hard-coding secrets like API keys directly into source files instead of using environment variables.
✅ Getting Started Checklist
💡 Before moving on, make sure you can check off each of these:
✔️ Node.js and npm are installed and node -v / npm -v both print a version number.
✔️ You've run at least one script successfully with node app.js.
✔️ You've opened and exited the Node.js REPL at least once.
✔️ You have a code editor set up with an integrated terminal.
✔️ You've created a package.json with npm init.
✔️ You've installed at least one package with npm install.
✔️ You understand why node_modules should not be committed to version control.
✅ Node.js Get Started — Quick Reference Table


Command / Term One-Line Meaning

node -v
Prints the installed Node.js version.

npm -v
Prints the installed npm version.

node app.js
Runs a saved JavaScript file with Node.js.

node
Opens the interactive REPL.

npm init -y
Creates a package.json with default values.

npm install <pkg>
Installs a package and adds it to package.json.

node_modules
Folder containing installed package code — never commit it.

package-lock.json
Auto-generated file locking exact dependency versions.

process.env
Object used to read environment variables at runtime.

node — inspect
Runs a script with the debugger enabled for Chrome DevTools.
✅ Try It Yourself: Code Game Playground
Edit the JavaScript below and click “Run” to see simulated console output. This demonstrates basic JavaScript concepts you would run identically inside Node.js using node yourfile.js.
Output will appear here…
✅ Practice — Yes / No Quiz
-
Does installing Node.js also install npm automatically?
-
Should beginners generally choose the “Current” version over “LTS” when installing Node.js?
-
Does typing
nodewith no filename start the interactive REPL? -
Should the
node_modulesfolder normally be committed to version control? -
Does
npm init -ycreate a package.json file using default values?
Your Score — Keep Practising! 🎯
✅ Frequently Asked Questions (FAQ)
✍️ About the Author — Pramod Behera
Pramod Behera is the founder of LearnToSAP.com and an experienced technology educator. He creates beginner-friendly tutorials spanning SAP modules, web development, and Cyber Security, helping thousands of learners worldwide build practical, job-ready skills.
Originally published at https://www.learntosap.com.
메타데이터
- post_id
- d1fecd3267aa
- slug
- node-js-get-started-install-setup-run-your-first-app-2026-27-d1fecd3267aa
- url
- https://medium.com/@learntosap2024/node-js-get-started-install-setup-run-your-first-app-2026-27-d1fecd3267aa
- canonical_url
- https://medium.com/@learntosap2024/node-js-get-started-install-setup-run-your-first-app-2026-27-d1fecd3267aa
- author_url
- https://medium.com/@learntosap2024
- status
- ok
- fetched_at
- 2026-07-28 08:12:08