Skip to content
X

What is Node.js?

Understanding Node.js makes it clear why JavaScript can run outside the browser, and suddenly things like npm install and the node command start to make sense. It also reveals how the AI tools I use every day actually work under the hood.

Target reader: Anyone who has learned terminal basics Estimated learning time: 10 min read Prerequisites: Basic terminal operations (cd, ls, etc.)


Node.js is a runtime environment that allows JavaScript to run outside the browser — on a server or in a terminal window.

JavaScript was originally designed to run inside web browsers and animate web pages. Node.js changed that. Once Node.js arrived, JavaScript became capable of handling server-side logic, building CLI tools, and powering AI applications.

Think of JavaScript as a recipe. A browser is one kitchen where that recipe can be cooked. Node.js is a completely separate kitchen — on a server or in a terminal — where the same recipe can be prepared. The recipe (JavaScript) is identical; only the kitchen (runtime) is different.


Modern web development relies on build tools that optimize and transform code before it reaches a browser. All the major tools run on Node.js.

ToolPurpose
ViteHigh-speed frontend build tool
webpackJavaScript bundler
ESLintCode quality checker
PrettierAutomatic code formatter

Installing Node.js is a prerequisite for using any of these.

With Node.js, I can write both frontend and backend logic in the same language. That means one language covers the full stack, which keeps the learning curve manageable.

As of 2026, Claude Code, GitHub Copilot CLI, and many other AI development tools are built on Node.js. Without it, I cannot even install them.

# Claude Code is installed via npm (which comes with Node.js)
npm install -g @anthropic-ai/claude-code

I can build command-line tools that run in the terminal.

// hello.js
console.log("Hello, Node.js!");
node hello.js
# Output: Hello, Node.js!

I can build an HTTP server that receives requests and sends responses.

// server.js
const http = require("http");

const server = http.createServer((req, res) => {
  res.end("Hello from Node.js server!");
});

server.listen(3000, () => {
  console.log("Server running at http://localhost:3000");
});
node server.js
# → Open http://localhost:3000 in a browser to see the response

I can read and write files, and automate repetitive folder tasks.

// list-files.js
const fs = require("fs");

const files = fs.readdirSync(".");
console.log(files);

Using Anthropic’s official SDK, I can build apps that talk to Claude.

// ai-chat.js
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic(); // Uses the ANTHROPIC_API_KEY environment variable

const message = await client.messages.create({
  model: "claude-opus-4-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "What is Node.js?" }],
});

console.log(message.content[0].text);

When I install Node.js, npm (Node Package Manager) is installed at the same time.

npm is a system that lets me easily use libraries (packages) created by other developers. More than two million packages are registered on npm, and I can add any of them to a project with a single command.

# Installing express (a web framework)
npm install express

# Installed packages are saved in the project's node_modules folder

Think of npm as an app store for developers. I can search for tools and libraries, then download and install them with one command.

CommandPurpose
npm installInstall a package into the project
npxRun a package temporarily without installing it
# Using npx to run without installing
npx create-react-app my-app

Node.js has multiple versions, and different projects may require different ones. When working across multiple projects, I use nvm (Node Version Manager) to install and switch between versions easily.

# Install Node.js 22 using nvm
nvm install 22
nvm use 22

# Check the current Node.js version
node -v
# → v22.15.0

See Installing nvm for a step-by-step setup guide.


  • Node.js is a runtime environment that lets JavaScript run outside the browser
  • It is used for frontend build tools, web servers, CLI tools, and AI applications
  • Installing Node.js also installs npm, giving access to millions of packages
  • nvm is the standard tool for managing multiple Node.js versions

Q: Do I need Node.js even if I am not writing JavaScript?

A: Yes. Even if you do not write JavaScript yourself, Node.js is required to run frontend build tools (Vite, webpack, etc.) and AI tools (Claude Code, etc.). These tools use Node.js as their execution environment.

Q: What is the difference between Node.js and Deno?

A: Deno is a newer JavaScript runtime redesigned by the original creator of Node.js. It improves on security and has native TypeScript support. However, as of 2026, Node.js has a vastly larger ecosystem of packages and tools, so it remains the standard choice for getting started.

Q: Which version of Node.js should I install?

A: Choose an LTS (Long Term Support) version. LTS versions receive security updates for an extended period and are the most stable choice. The current LTS at time of writing is Node.js 22.