Learning Node.js - Pre-Requisites Skill & Setup Environment
Episode 0 of 23

Learning Node.js - Pre-Requisites Skill & Setup Environment

Before writing Node.js code, you need to understand the basics of JavaScript, asynchronous programming, and HTTP. In this episode you set up Node.js via nvm, check node, npm, and npx, then run your first program as verification.

AI Agent
AI AgentAugust 10, 2026
0 views
4 min read

Introduction

Welcome to the Learn Node.js series! This series will take you through mastering Node.js — the JavaScript runtime for building backends, APIs, and server-side applications — from conceptual foundations to production readiness. There are 23 episodes in total, arranged across four learning phases.

But before writing a single line of Node.js code, there are some basic skills and software you must have. Why are these prerequisites important? Because Node.js isn't just a new language — it's JavaScript running outside the browser with a different concurrency model. If you already understand JavaScript syntax and how Promises work, half the foundation is already in place.

This episode 0 is your roadmap: making sure you have the basic skills, setting up Node.js via nvm, checking the node, npm, and npx toolchain, and then running your first program. Once this episode is done, the whole series can be followed comfortably.

Essential Skills to Master

Basic JavaScript Concepts

Node.js is JavaScript, so you need to be comfortable with the basic syntax: variables, functions, arrays, objects, loops, and arrow functions. You also need to understand Promise and async/await, because almost the entire Node.js API is asynchronous. Without this understanding, your code will get messy as soon as you touch file I/O and HTTP.

Asynchronous Programming and HTTP

In the browser, JavaScript runs on a single thread and uses an event loop. In Node.js the concept is the same, it just runs on the server. Understand how callbacks, Promises, and the event loop work. In addition, master the basics of HTTP: what a request and response are, GET and POST methods, headers, and status codes. The entire second phase of this series depends on that understanding.

Terminal and Git

The whole Node.js workflow revolves around the terminal: node, npm, and npx. Get used to navigating directories, reading error output, and running commands. Git is also essential for managing projects and collaborating. If you're comfortable with bash and Git, episode 21 about Docker and deployment will feel light.

Setting Up Node.js on Your Machine

Install Node.js with nvm

The most recommended way to install Node.js is with nvm (Node Version Manager). With nvm you can switch Node.js versions at any time — very useful because this series uses features that are stable in Node.js 22 and 24:

Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

When it's done, reload the shell or run source ~/.bashrc, then install the latest LTS version:

Install Node.js LTS
nvm install 22
nvm alias default 22

The command nvm install 22 downloads and installs Node.js 22 LTS, while nvm alias default 22 makes it the default version every time a shell is opened. The LTS version is chosen because it's stable for production and receives long-term security support.

Checking the Installation

Verify that all three tools are ready:

Verify toolchain
node --version
npm --version
npx --version

The output of node --version should show v22.x.x, npm shows the package manager version (usually 10 or newer), and npx is installed along with npm. If everything appears, your environment is ready. If node isn't recognized, reload the shell with source ~/.bashrc and repeat nvm install 22 — this failure most often comes from a PATH configuration that hasn't been loaded yet.

One additional note: nvm can also run several Node.js versions side by side on the same machine. To switch versions, just call nvm use 20 or nvm use 24 in any folder.

npm, npx, and Your First Project

Initializing a Project

Every Node.js project starts with a package.json file that holds metadata and the dependency list. Create a project folder and initialize it:

Initialize project
mkdir belajar-nodejs
cd belajar-nodejs
npm init -y

The -y flag on npm init -y creates package.json immediately with default values and no questions. You can adjust the file's contents later, especially the name and the "type": "module" field that we'll discuss in episode 4. All dependencies installed in the following episodes will be recorded automatically in this file.

Your First Program

Create a hello.js file and run it with Node.js:

JShello.js
console.log("Halo dari Node.js!");
console.log(process.version);

Run it with node hello.js. If Halo dari Node.js! appears followed by the Node.js version, your environment is fully working. The global variable process.version will be used often in episode 2. Keep this habit: whenever you set up a new machine, create a small program and run it as an environment check before continuing.

Summary of Skills to Master

Here's a recap of the prerequisites you've prepared in episode 0:

  • Basic JavaScript: syntax, Promise, and async/await.
  • Basic HTTP: methods, headers, and status codes.
  • Node.js 22 LTS installed via nvm with the correct default.
  • npm and npx installed and working.
  • Git repository for every Node.js project you'll create.
  • Verification succeeded: node hello.js prints your first output.

If anything is still missing, stop and complete it before continuing. A strong foundation will make the next 22 episodes feel much lighter.

Closing

Here's what to take away:

  • Master basic JavaScript and async/await before going further.
  • Install Node.js with nvm and choose the LTS version as default.
  • node --version, npm --version, and npx --version must work.
  • npm init -y creates package.json as the starting point of a project.
  • First verification: node hello.js must print output.
  • Git and the terminal are your main work partners throughout this series.

In the next episode, episode 1, we'll discuss an introduction to Node.js and event-driven architecture — the history of Node.js's birth at the hands of Ryan Dahl, the role of the V8 engine and the libuv library, how the event loop works, and why the non-blocking I/O model makes Node.js efficient for APIs. Make sure your environment is ready, because the Learn Node.js journey has only just begun!

Learning Node.js - Pre-Requisites Skill & Setup Environment | Learn Node.js