Node.js
Overview
Node.js is an open-source, cross-platform JavaScript runtime environment built on the V8 engine. It runs JavaScript (and, via loaders/transpilers, TypeScript) outside the browser to build servers, CLIs, and tooling. Read this when choosing or configuring the runtime for a JS/TS backend, scripts, or build tooling. The project is governed under the OpenJS Foundation.
Official sources
Install / setup
The official download page provides prebuilt installers and binaries plus a version-manager flow. To verify a manual install, download the platform installer/binary from the download page, then confirm:
node --version
npm --version
For multiple versions, the download page recommends a Node version manager (e.g. nvm); follow the exact script shown on https://nodejs.org/en/download/package-manager.
Core concepts
- Single-threaded event loop with non-blocking async I/O — long synchronous work blocks all requests.
- CommonJS (
require) and ECMAScript Modules (import); .mjs/"type": "module" select ESM behavior.
- Built-in core modules (
fs, http, path, crypto, worker_threads, etc.) documented in the API reference.
npm is the bundled package manager; package.json declares dependencies, scripts, and module type.
- Release lines: even-numbered majors become Long Term Support (LTS); odd majors are "Current" only.
worker_threads and the cluster model offload CPU-bound work off the main event loop.
Best practices
- Pin to an active LTS release for production stability (see https://nodejs.org/en/about/previous-releases).
- Keep CPU-heavy tasks off the event loop using worker threads or external services.
- Commit a lockfile (
package-lock.json) and prefer npm ci for reproducible installs.
- Handle async errors explicitly; attach handlers for
unhandledRejection/uncaughtException only for logging and graceful shutdown.
Common pitfalls
- Blocking the event loop with synchronous/CPU-bound code → offload to worker threads or break work into async chunks.
- Mixing CommonJS and ESM incorrectly (e.g.
require of an ESM-only package) → align "type" and import style per the modules docs.
- Relying on an end-of-life Node version → track the release schedule and upgrade to a supported LTS.
Examples
import http from 'node:http';
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello from Node.js');
});
server.listen(3000, () => console.log('listening on :3000'));
Further reading
Related skills
- ../bun — alternative JS/TS runtime and toolkit
- ../deno — secure JS/TS runtime with built-in tooling
1---2name: node3description: Node.js — the standard cross-platform JavaScript/TypeScript server runtime built on V8; consult for server/CLI/tooling work in JS.4domain: stack5category: runtime6tags: [nodejs, javascript, typescript, v8, runtime, npm]7official_sources:8 - https://nodejs.org/docs/latest/api/9 - https://github.com/nodejs/node10verified: 2026-06-1611metadata:12 source: https://skillmd.com/skills/gabriel7silva/node13---1415# Node.js1617## Overview18Node.js is an open-source, cross-platform JavaScript runtime environment built on the V8 engine. It runs JavaScript (and, via loaders/transpilers, TypeScript) outside the browser to build servers, CLIs, and tooling. Read this when choosing or configuring the runtime for a JS/TS backend, scripts, or build tooling. The project is governed under the OpenJS Foundation.1920## Official sources21- Docs: https://nodejs.org/docs/latest/api/22- Repo: https://github.com/nodejs/node23- Install / download: https://nodejs.org/en/download2425## Install / setup26The official download page provides prebuilt installers and binaries plus a version-manager flow. To verify a manual install, download the platform installer/binary from the download page, then confirm:2728```bash29node --version30npm --version31```3233For multiple versions, the download page recommends a Node version manager (e.g. `nvm`); follow the exact script shown on https://nodejs.org/en/download/package-manager.3435## Core concepts36- Single-threaded event loop with non-blocking async I/O — long synchronous work blocks all requests.37- CommonJS (`require`) and ECMAScript Modules (`import`); `.mjs`/`"type": "module"` select ESM behavior.38- Built-in core modules (`fs`, `http`, `path`, `crypto`, `worker_threads`, etc.) documented in the API reference.39- `npm` is the bundled package manager; `package.json` declares dependencies, scripts, and module type.40- Release lines: even-numbered majors become Long Term Support (LTS); odd majors are "Current" only.41- `worker_threads` and the cluster model offload CPU-bound work off the main event loop.4243## Best practices44- Pin to an active LTS release for production stability (see https://nodejs.org/en/about/previous-releases).45- Keep CPU-heavy tasks off the event loop using worker threads or external services.46- Commit a lockfile (`package-lock.json`) and prefer `npm ci` for reproducible installs.47- Handle async errors explicitly; attach handlers for `unhandledRejection`/`uncaughtException` only for logging and graceful shutdown.4849## Common pitfalls50- Blocking the event loop with synchronous/CPU-bound code → offload to worker threads or break work into async chunks.51- Mixing CommonJS and ESM incorrectly (e.g. `require` of an ESM-only package) → align `"type"` and import style per the modules docs.52- Relying on an end-of-life Node version → track the release schedule and upgrade to a supported LTS.5354## Examples55```js56import http from 'node:http';5758const server = http.createServer((req, res) => {59 res.writeHead(200, { 'Content-Type': 'text/plain' });60 res.end('Hello from Node.js');61});6263server.listen(3000, () => console.log('listening on :3000'));64```6566## Further reading67- API reference: https://nodejs.org/docs/latest/api/68- Release schedule: https://nodejs.org/en/about/previous-releases6970## Related skills71- ../bun — alternative JS/TS runtime and toolkit72- ../deno — secure JS/TS runtime with built-in tooling