← Back to Node.js Course | Chapter 1: Introduction | Lesson 4 of 7

Installing Node.js

You download Node.js once, and it installs both the node command and npm.

In this page:

  1. Installing Node.js

Installing Node.js

Download the LTS installer from nodejs.org, or use a version manager such as nvm so you can switch versions per project. Package managers like apt, brew and winget also work. After installing, verify with node --version and npm --version.

Note: Use the LTS (long-term support) release for production projects.

Example: Installing Node.js

bash
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
$ nvm install --lts
$ node --version
v20.11.1
$ npm --version
10.2.4

⚠️ Run this in your own terminal or Node.js environment.

Related Topics
Common Mistakes
  1. Installing an odd-numbered non-LTS release for production
  2. Installing with sudo npm and creating permission problems
  3. Not restarting the terminal so PATH is not updated
Chapter Summary
  • Install the LTS release
  • nvm manages multiple versions
  • node --version verifies the install
  • npm comes bundled
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.