DEV Community

Cover image for How to Install Node.js on Linux Mint (Step-by-Step Guide)
Sunil Pradhan
Sunil Pradhan

Posted on

How to Install Node.js on Linux Mint (Step-by-Step Guide)

If you're a web developer using Linux Mint, you'll eventually need to install Node.js to work with modern JavaScript frameworks like React, Next.js, Angular, or Vue.

One of the first questions many beginners ask is:

Does Linux Mint come with Node.js preinstalled?

The answer is No. Linux Mint does not include Node.js or npm by default. You need to install it manually.

In this guide, I'll show you the different ways to install Node.js on Linux Mint and explain which method I recommend for developers.

What is Node.js?

Node.js is an open-source JavaScript runtime built on Chrome's V8 engine. It allows you to run JavaScript outside the browser and is widely used for:

  • Building web applications
  • Creating APIs and backend services
  • Running development tools like Vite and Webpack
  • Working with frameworks such as React, Next.js, and Angular

Check Whether Node.js Is Already Installed

Before installing Node.js, open the terminal and run:

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

If Node.js is installed, you'll see something like:

v24.4.1
11.5.1
Enter fullscreen mode Exit fullscreen mode

If you receive:

Command 'node' not found

then Node.js is not installed on your system.

Method 1: Install Node.js Using NVM (Recommended)

For developers, this is the best method because it allows you to install and switch between multiple Node.js versions.

Step 1: Update the package list

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Curl

sudo apt install curl -y
Enter fullscreen mode Exit fullscreen mode

What does this command do?

  • sudo – Runs the command with administrator privileges.
  • apt – Linux Mint's package manager.
  • install – Installs a package.
  • curl – A command-line tool used to download files from the internet.
  • -y – Automatically answers "Yes" to installation prompts.

Step 3: Install NVM (Node Version Manager)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.5/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Replace the version number if a newer NVM version is available. This command downloads the NVM installation script and immediately executes it.

Step 4: Reload Your Shell

For Bash users:

source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

For Zsh users:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can close and reopen the terminal.

Step 5: Verify NVM Installation

nvm --version
Enter fullscreen mode Exit fullscreen mode

Example output:

0.40.5
Enter fullscreen mode Exit fullscreen mode

Step 6: Install the Latest LTS Version of Node.js

nvm install --lts
Enter fullscreen mode Exit fullscreen mode

Step 7: Verify Node.js Installation

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

Example:

v24.18.0
11.16.0
Enter fullscreen mode Exit fullscreen mode

Install a Specific Version of Node.js

For example, to install Node.js 22:

nvm install 22
Enter fullscreen mode Exit fullscreen mode

Use that version:

nvm use 22
Enter fullscreen mode Exit fullscreen mode

Set it as the default:

nvm alias default 22
Enter fullscreen mode Exit fullscreen mode

List All Installed Node.js Versions

nvm list
Enter fullscreen mode Exit fullscreen mode

Example output:

List All Installed Node.js Versions

Method 2: Install Node.js Using APT

Linux Mint also allows you to install Node.js directly from its repositories.

sudo apt update
sudo apt install nodejs npm
Enter fullscreen mode Exit fullscreen mode

Verify:

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

Pros

  • Very easy to install.
  • Good for beginners.

Cons

  • Usually provides an older version of Node.js.
  • Not suitable if you need multiple versions.

Method 3: Install Node.js Using NodeSource

Install the NodeSource repository:

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
Enter fullscreen mode Exit fullscreen mode

Install Node.js:

sudo apt install nodejs
Enter fullscreen mode Exit fullscreen mode

Verify:

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

Pros

  • Provides newer versions than the default Linux Mint repository.

Cons

  • Doesn't manage multiple versions like NVM.

My Recommendation

As a front-end developer working with React and Next.js, I prefer using NVM because different projects often require different Node.js versions.

With NVM, switching between versions is easy:

nvm install 20
nvm install 22
nvm use 20
nvm use 22
Enter fullscreen mode Exit fullscreen mode

This flexibility makes NVM the ideal choice for developers using Linux Mint.

Final Thoughts

Linux Mint does not come with Node.js preinstalled, but installing it is straightforward.

If you're a beginner, the APT method is simple and works well.

If you're a developer, especially one working with modern JavaScript frameworks, I highly recommend installing Node.js using NVM. It gives you complete control over Node.js versions and makes managing projects much easier.

Top comments (0)