What Is Node.js and How to Install It
What Is Node.js and How to Install It
Node.js is a JavaScript runtime built on Chrome's V8 engine. It runs JavaScript outside the browser, so the same language you know from the frontend can build servers, CLIs, and automation tools.
Why Node exists
Browsers can only run JavaScript inside a page. Node brings the V8 engine to the server, adds APIs for files, network, and processes, and gives developers one language across the whole stack.
Installing Node
Download the LTS installer from nodejs.org and run it. On macOS you can also use Homebrew, and on Linux your package manager works. To verify the install:
node --version
npm --version
Both commands should print version numbers. npm ships with Node, so you get a package manager for free.
Running your first script
Create a file and run it:
// hello.js
console.log('Hello, Node!');
node hello.js
Node executes the file top to bottom and prints the message. There is no HTML, no DOM: just JavaScript and the console.
REPL mode
Typing node with no file opens a REPL, an interactive prompt where each line runs immediately. It is handy for quick experiments and arithmetic checks.
What you can build
With Node you can write REST APIs, real-time chat with WebSockets, command-line tools, and automation scripts. This series focuses on server-side JavaScript, starting from the event loop in the next lesson.
Key Points
- Node.js runs JavaScript outside the browser.
- Install the LTS build from nodejs.org.
- node --version and npm --version verify setup.
- Run scripts with node filename.js.
- Node powers servers, CLIs, and tooling.