Node.js is a program you install on your computer, the same way you'd install any other application. Once it's installed, you get two new commands in your terminal: node and npm.
Download the installer from nodejs.org. You'll see two options — always pick the one labeled LTS (Long-Term Support). It's the version that's had the most testing and is what most real projects run in production; the other option changes too often to be worth the risk while you're learning.
Open a terminal and run:
node --version
npm --versionBoth commands should print a version number. If you see "command not found" instead, the installer likely needs your terminal restarted, or on Windows, a system restart, before the new commands are recognized.
Create a file called hello.js with one line:
console.log("Hello from Node.js")Then run it from the terminal, in the same folder:
node hello.jsThat's the entire workflow: write JavaScript in a file, hand the file to node, and it runs — no browser, no HTML page, nothing else involved.
Running node with no filename drops you into the REPL (Read-Eval-Print Loop) — a prompt where you can type JavaScript one line at a time and see the result immediately. It's useful for quickly testing a small piece of code without creating a file.
$ node
> 2 + 2
4
> "hello".toUpperCase()
'HELLO'
> .exitType .exit, or press Ctrl+C twice, to leave the REPL.