Back to blog

Published on Thursday, December 26, 2024

How to Install Node.js on Linux

How to Install Node.js on Linux

Step 1: Update Your Package Manager

First, it's a good idea to update your package manager to ensure you have the latest package lists:

sudo apt update

Step 2: Install Required Dependencies

Rust requires some development tools like curl and build-essential. You can install them using the following command:

sudo apt install curl build-essential

Step 3: Install nvm (Node Version Manager)

First, you need to install nvm, a tool that allows you to manage multiple versions of Node.js on your machine.

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

Step 4: Install Node.js

After installing nvm, you can use it to install Node.js. You might need to restart your terminal after the installation.

nvm install 20

Step 5: Verify Installation

Finally, verify that the correct versions of Node.js and npm are installed.

node -v # should output `v20.17.0`
npm -v  # should output `v10.8.2`

Conclusion

You've successfully installed Node.js on your Linux system! With Node.js up and running, you can start building modern web applications, APIs, and more. Whether you're a beginner or an experienced developer, Node.js offers a powerful platform to bring your ideas to life.