Installing Node.js
To use Node.js, download and install it from nodejs.org. Installation includes both the `node` runtime and `npm`, the Node Package Manager.
After installing, you can verify everything works by checking version numbers from your terminal.
Installing
Download the LTS (Long Term Support) version for stability. Installers exist for Windows, macOS and Linux, and Linux users can also install via package managers like apt or nvm.
Verifying the install
Use `node -v` and `npm -v` in a terminal to confirm the versions installed. If these commands fail, Node isn't on your PATH.
node -v
npm -vv20.11.0
10.2.4These commands print the installed versions of Node.js and npm.
node app.jsHello from Node.js!Running a JavaScript file with the `node` command executes it using the Node.js runtime.
Key points
- Download Node.js from nodejs.org (LTS recommended).
- Installing Node.js also installs npm.
- `node -v` checks the Node version.
- Run any JS file with `node filename.js`.
