How to Install Node.js on Linux Mint 22 and 21

Last updated Tuesday, March 24, 2026 1:48 pm 10 min read

Linux Mint’s default Node.js packages are old enough to trip modern JavaScript build tools and local dev servers before you even open a project. If you need to install Node.js on Linux Mint, choose between Mint’s conservative APT packages, a current NodeSource release through APT, or NVM for per-project version switching.

Linux Mint 22.x and 21.x both support the three methods below, but the default APT versions differ sharply between them. NodeSource and NVM stay much closer to upstream releases, which is why they fit current development work better than the distro package on either Mint branch.

Install Node.js on Linux Mint

Each installation path solves a different version-management problem:

MethodChannelVersionUpdatesBest For
Linux Mint RepositoryMint and Ubuntu packagesMint 22.x: Node.js 18.x, npm 9.2.x
Mint 21.x: Node.js 12.x, npm 8.5.x
Automatic with apt upgradeOlder local workloads that only need the distro package
NodeSource RepositoryNodeSourceNode.js 24.x with npm 11.9.xAutomatic with apt upgradeOne supported system-wide Node.js version
Node Version Manager (NVM)NVMAny supported Node.js releaseManual with nvm installPer-project version switching and CI parity
  • Pick the Linux Mint repository if you only need the distro package and do not care about running a current upstream Node.js release.
  • Pick NodeSource if you want one supported Node.js version that updates through APT and behaves like a normal system package.
  • Pick NVM if different projects pin different Node.js majors or you want to keep runtime changes inside your user account.

These instructions support Linux Mint 22.x and 21.x. Use one method at a time: Method 1 and Method 2 both install system-wide nodejs packages, so switching later is cleaner when you remove the earlier packages first instead of layering sources.

Method 1 currently installs end-of-life Node.js branches on both supported Mint releases. For new development work, start with Method 2 or Method 3.

Before installing, refresh the package index and apply any pending security updates:

sudo apt update && sudo apt upgrade

These commands use sudo for tasks that need root privileges. If your account does not have sudo access yet, follow the guide to add a user to sudoers on Linux Mint before continuing.

Method 1: Install Node.js from Linux Mint Repository

The Linux Mint repository is the lowest-maintenance path, but it follows the Ubuntu base rather than the current Node.js release schedule.

Default Node.js Versions on Linux Mint 22.x and 21.x

Linux Mint ReleaseDefault nodejsDefault npmUpstream Status
Linux Mint 22.x18.19.x9.2.xEnd-of-life
Linux Mint 21.x12.22.x8.5.xEnd-of-life

Install nodejs and npm together because Linux Mint ships them as separate packages in the default repository:

sudo apt install -y nodejs npm

Verify both packages after the install finishes:

node --version
npm --version
# Linux Mint 22.x
v18.19.1
9.2.0

# Linux Mint 21.x
v12.22.9
8.5.1

Both of those Node.js branches are upstream end-of-life. If you are starting a new project, switch to Method 2 or Method 3 instead and review the official Node.js end-of-life schedule before you stay on the distro package.

Method 2: Install Node.js from NodeSource on Linux Mint

NodeSource gives Linux Mint a current upstream Node.js line through APT, which is the better fit when you want one supported system package for active projects.

Install NodeSource Prerequisites on Linux Mint

Install curl, CA certificates, and gpg before adding the repository:

sudo apt install -y curl ca-certificates gpg

Import NodeSource GPG Key on Linux Mint

Create the keyrings directory if your system does not already have it:

sudo install -m 0755 -d /etc/apt/keyrings

Next, download the ASCII-armored NodeSource signing key and convert it into the binary format APT expects:

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor --yes -o /etc/apt/keyrings/nodesource.gpg

Add NodeSource Repository on Linux Mint

Set the major release you want, then write the DEB822 source file. NodeSource uses the universal nodistro suite here, so you do not need a Mint-to-Ubuntu codename mapping table for this method.

NODE_MAJOR=24
printf '%s\n' "Types: deb" "URIs: https://deb.nodesource.com/node_${NODE_MAJOR}.x" "Suites: nodistro" "Components: main" "Signed-By: /etc/apt/keyrings/nodesource.gpg" | sudo tee /etc/apt/sources.list.d/nodesource.sources > /dev/null
  • NODE_MAJOR=20: Maintenance LTS for older compatibility targets
  • NODE_MAJOR=22: Maintenance LTS
  • NODE_MAJOR=24: Active LTS, recommended for most new Linux Mint projects
  • NODE_MAJOR=25: Current release with the newest features and a shorter support window

Keep NODE_MAJOR=24 if you want the current LTS line. Change it before the next step when your project needs another supported major.

If Linux Mint 21 already has the distro nodejs packages installed, remove libnode-dev, nodejs, and npm before switching. That old libnode-dev package can block the NodeSource install with a file overwrite error.

Install Node.js from NodeSource on Linux Mint

Refresh APT so Linux Mint can see the new repository:

sudo apt update

Relevant output includes:

Hit:2 https://deb.nodesource.com/node_24.x nodistro InRelease
Reading package lists... Done

Confirm that apt now prefers the NodeSource candidate:

apt-cache policy nodejs | sed -n '1,8p'
nodejs:
  Installed: (none)
  Candidate: 24.14.0-1nodesource1
  Version table:
    24.14.0-1nodesource1 500
      500 https://deb.nodesource.com/node_24.x nodistro/main amd64 Packages

Install Node.js. NodeSource bundles npm inside the nodejs package, so you do not install a second package here:

sudo apt install -y nodejs

Verify the runtime and npm versions after the install finishes:

node --version
npm --version
v24.14.0
11.9.0

Method 3: Install Node.js with NVM on Linux Mint

NVM keeps Node.js inside your home directory and makes version switching easy, which is why it stays popular on laptops, workstations, and shared developer boxes.

Install NVM on Linux Mint

If curl --version reports command not found, install it first:

sudo apt install -y curl

Download the current NVM installer and run it under your user account:

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

The installer appends NVM initialization lines to your shell profile. Load them into the current Bash session without reopening the terminal:

source ~/.bashrc

Confirm that the shell can see NVM:

command -v nvm
nvm

NVM is a shell function, not a binary. Use command -v nvm to verify it, not which nvm. If you use Zsh, load ~/.zshrc instead of ~/.bashrc.

Install Node.js with NVM on Linux Mint

Install the latest LTS release through NVM:

nvm install --lts
Downloading and installing node v24.14.0...
Now using node v24.14.0 (npm v11.9.0)

Verify the active runtime:

node --version
npm --version
v24.14.0
11.9.0

Keep the LTS alias active in new terminals if you want the latest supported line by default:

nvm use --lts
nvm alias default lts/*
Now using node v24.14.0 (npm v11.9.0)
default -> lts/* (-> v24.14.0 *)

Pin a Project Node.js Version with .nvmrc on Linux Mint

Create a small .nvmrc file in the project root when you want the shell to pick a specific major automatically:

mkdir -p ~/node-demo
cd ~/node-demo
printf '24\n' > .nvmrc
nvm use
Found '/home/your-user/node-demo/.nvmrc' with version <24>
Now using node v24.14.0 (npm v11.9.0)

Most Node.js projects live in Git repositories, so this is a good point to install Git on Linux Mint if you still need version control on the same workstation.

Update Node.js on Linux Mint

Use the update path that matches the method you picked originally so you do not mix runtimes or repository metadata.

Update Linux Mint Repository Node.js on Linux Mint

Update the distro packages together because the Linux Mint repository keeps nodejs and npm separate:

sudo apt update
sudo apt install --only-upgrade nodejs npm

Verify the versions after the upgrade:

node --version
npm --version
# Linux Mint 22.x
v18.19.1
9.2.0

# Linux Mint 21.x
v12.22.9
8.5.1

Update NodeSource Node.js on Linux Mint

If you stay on the same NodeSource major, refresh APT and upgrade nodejs. If you want a different major, change NODE_MAJOR and overwrite the same source file before running the upgrade.

NODE_MAJOR=24
printf '%s\n' "Types: deb" "URIs: https://deb.nodesource.com/node_${NODE_MAJOR}.x" "Suites: nodistro" "Components: main" "Signed-By: /etc/apt/keyrings/nodesource.gpg" | sudo tee /etc/apt/sources.list.d/nodesource.sources > /dev/null
sudo apt update
sudo apt install --only-upgrade nodejs

Confirm that APT still points at the NodeSource candidate:

apt-cache policy nodejs | sed -n '1,8p'
nodejs:
  Installed: 24.14.0-1nodesource1
  Candidate: 24.14.0-1nodesource1
  Version table:
 *** 24.14.0-1nodesource1 500
      500 https://deb.nodesource.com/node_24.x nodistro/main amd64 Packages

Update NVM Node.js on Linux Mint

NVM updates by installing the newer release, refreshing your default alias, and switching the current shell:

nvm install --lts
nvm alias default lts/*
nvm use --lts
Now using node v24.14.0 (npm v11.9.0)
default -> lts/* (-> v24.14.0 *)

Troubleshoot Node.js on Linux Mint

The most common Linux Mint Node.js problems come from switching package sources halfway through an install or forgetting that NVM only exists after the shell profile loads it.

Fix NodeSource File Overwrite Errors on Linux Mint 21

If Mint 21 already has the distro Node.js packages installed, NodeSource can fail with an overwrite error like this:

trying to overwrite '/usr/include/node/common.gypi', which is also in package libnode-dev 12.22.9~dfsg-1ubuntu3.6

The cause is the old Mint 21 libnode-dev package. Remove the distro runtime and headers, then install NodeSource again:

sudo apt remove --purge -y libnode-dev nodejs npm
sudo apt autoremove
sudo apt install -y nodejs

Verify the switch completed cleanly:

node --version
npm --version
v24.14.0
11.9.0

Fix NVM Command Not Found Errors on Linux Mint

If the installer finished but the current shell still cannot see NVM, you usually get this:

nvm: command not found

Reload the Bash profile first:

source ~/.bashrc

If you use Zsh instead, reload the Zsh profile:

source ~/.zshrc

Verify that NVM is now loaded:

command -v nvm
nvm

Remove Node.js from Linux Mint

The removal path depends on how you installed Node.js in the first place. Remove only the method you actually used.

Remove Node.js Installed from Linux Mint Repository

Remove the distro packages together, then let APT clean up anything it no longer needs:

sudo apt remove --purge -y nodejs npm
sudo apt autoremove

Review the apt autoremove list before you accept it on a reused workstation, then clean the user npm cache only if you no longer need it:

rm -rf ~/.npm

Confirm the package is gone and the node command no longer exists:

apt-cache policy nodejs | sed -n '1,8p'
node --version
nodejs:
  Installed: (none)
  Candidate: 18.19.1+dfsg-6ubuntu5
  Version table:
     18.19.1+dfsg-6ubuntu5 500
        500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages
bash: line 1: node: command not found

On Linux Mint 21.x, the candidate line falls back to 12.22.9~dfsg-1ubuntu3.6 instead of the Mint 22.x package shown above.

Remove Node.js Installed from NodeSource on Linux Mint

Remove the NodeSource package, delete the repository files, then refresh APT so Linux Mint falls back to its own package candidate again:

sudo apt remove --purge -y nodejs
sudo rm -f /etc/apt/sources.list.d/nodesource.sources
sudo rm -f /etc/apt/keyrings/nodesource.gpg
sudo apt update

Remove ~/.npm only if you also want to clear your per-user npm cache. It is optional cleanup, not a requirement for removing the system package.

rm -rf ~/.npm

Verify that the NodeSource package is gone and that APT now prefers the Linux Mint repository again:

apt-cache policy nodejs | sed -n '1,8p'
node --version
nodejs:
  Installed: (none)
  Candidate: 18.19.1+dfsg-6ubuntu5
  Version table:
     18.19.1+dfsg-6ubuntu5 500
        500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages
bash: line 1: node: command not found

On Linux Mint 21.x, the candidate line falls back to 12.22.9~dfsg-1ubuntu3.6 after the NodeSource files are removed.

Remove Node.js Installed with NVM on Linux Mint

Unload NVM from the current shell, then delete the NVM directory and its npm cache:

nvm unload
rm -rf ~/.nvm ~/.npm

After that, remove the NVM initialization lines from ~/.bashrc or ~/.zshrc, then reload the shell profile you actually use:

source ~/.bashrc

Verify that NVM is gone. command -v nvm should return no output, and node --version should fail in a clean shell:

command -v nvm
node --version
bash: line 1: node: command not found

Node.js on Linux Mint FAQ

Is Node.js available in Linux Mint repositories?

Yes. Linux Mint 22.x ships Node.js 18.x with npm 9.2.x, and Linux Mint 21.x ships Node.js 12.x with npm 8.5.x. Both Node.js branches are upstream end-of-life, so NodeSource or NVM is the safer choice for new projects.

Should I use NodeSource or NVM on Linux Mint?

Use NodeSource when you want one system-wide Node.js version that updates through APT. Use NVM when different projects need different Node.js versions or when you want to avoid changing the system package set.

Why did NodeSource fail with a file overwrite error on Linux Mint 21?

Linux Mint 21 can still have libnode-dev, nodejs, and npm from the distro repository. Those files conflict with the newer NodeSource package. Remove the distro packages first with sudo apt remove --purge -y libnode-dev nodejs npm, then install NodeSource nodejs again.

Does NodeSource install npm separately on Linux Mint?

No. On the NodeSource method, npm is bundled inside the nodejs package, so sudo apt install -y nodejs installs both.

Conclusion

Node.js is now running on Linux Mint through the package workflow that fits your projects, whether that is one system runtime from NodeSource or version switching through NVM. To finish the workstation setup, you can install VS Code on Linux Mint and point it at the runtime you just configured.

Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: