A Beginner's Guide to Installing Node.js

Leroy · 4 Oct 2023 · 1 min read

NodeJS Picture! Photo by RealToughCandy.com

Installing Node.js

Node.js is a JavaScript runtime for running code outside the browser. I use nvm, the Node Version Manager, to install and switch between Node versions.

Install nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Restart your terminal or reload your shell config:

source ~/.bashrc

Install a Node Version

nvm install --lts

This installs the latest LTS release. You can also install a specific version:

nvm install 18
nvm install 20

Switch Between Versions

nvm use 20

Set a default:

nvm alias default 20

Verify

node --version
npm --version

Global Packages (Optional)

npm install -g nodemon

That's it. Node.js and npm are ready.

related posts

04 Oct
A Beginner's Guide to Installing Node.js
Step-by-step guide to installing Node.js on Windows, macOS, and Linux, ensuring a hassle-free setup for developers.
01 Jun
What is Bun? A JavaScript Runtime, Bundler, and Package Manager
Bun is a JavaScript runtime, package manager, test runner, and bundler in a single binary. Here is what it does and how it works.
01 Jun
What is uv? A Python Package Manager
uv is a Rust-based Python package manager that is faster than pip. It installs Python versions, resolves dependencies, and manages virtual environments in one binary.