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

Install Node.js on Linux Mint 22.x and 21.x with APT, NodeSource, or NVM. Covers npm, updates, removal, and fixes.

Last updatedAuthorJoshua JamesRead time10 minGuide typeLinux Mint

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, the right installation path depends on how closely you want to track upstream releases and whether one shared runtime is enough for your projects.

Linux Mint 22.x and 21.x both support these three methods, 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:

MethodChannelNode.js BranchUpdatesBest 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
APT-managed with apt upgradeOlder local workloads that only need the distro package
NodeSource RepositoryNodeSourceNode.js 24.x LTS with bundled npm 11.xAPT-managed 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 supported upstream Node.js branch.
  • 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.

Use one method at a time on Linux Mint 22.x or 21.x. The Linux Mint repository and NodeSource both install system-wide nodejs packages, so switching later is cleaner when you remove the earlier packages first instead of layering sources.

The Linux Mint repository path installs end-of-life Node.js branches on both supported Mint releases. For new development work, start with NodeSource or NVM.

Before installing, refresh the package index and apply any pending package 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.

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 nodejs npm

Verify both packages after the install finishes:

node --version
npm --version

Example output on Linux Mint 22.x:

v18.19.1
9.2.0

Linux Mint 21.x reports v12.22.9 and 8.5.1 from the same verification commands. If apt tells you nodejs is already the newest version (18.19.1+dfsg-6ubuntu5) on Linux Mint 22.x, or the 12.22.9 build on Linux Mint 21.x, that result is normal for the Linux Mint repository path. It means APT is using the distro package exactly as intended, not the newer NodeSource or NVM path.

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

Install Node.js from NodeSource on Linux Mint

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

Install NodeSource Prerequisites on Linux Mint

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

sudo apt install 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, confirm the standard Linux Mint amd64 APT architecture, 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
NODE_ARCH="$(dpkg --print-architecture)"

case "${NODE_ARCH}" in
    amd64)
        printf '%s\n' \
        'Types: deb' \
        "URIs: https://deb.nodesource.com/node_${NODE_MAJOR}.x" \
        'Suites: nodistro' \
        'Components: main' \
        "Architectures: ${NODE_ARCH}" \
        'Signed-By: /etc/apt/keyrings/nodesource.gpg' | sudo tee /etc/apt/sources.list.d/nodesource.sources > /dev/null
        ;;
    *)
        printf 'This NodeSource Linux Mint workflow expects APT architecture amd64. Your system reports %s.\n' "${NODE_ARCH}" >&2
        false
        ;;
esac

This uses sudo tee so the DEB822 file is written with root permissions. A plain > redirection would still run in your normal shell and fail to write inside /etc/apt/sources.list.d/. The architecture guard stops before writing the source file on non-amd64 systems.

  • NODE_MAJOR=22: Maintenance LTS
  • NODE_MAJOR=24: Active LTS, recommended for most new Linux Mint projects
  • NODE_MAJOR=26: Current release for projects that explicitly support the non-LTS branch

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 a project rejects Current releases or asks for an LTS branch, use 24 or 22 instead of 26.

NodeSource keeps the major line stable, but point releases and bundled npm revisions keep moving inside that branch. The verification output uses 24.x.x and 11.x.x placeholders so it stays accurate after routine NodeSource updates.

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

Relevant output includes:

nodejs:
  Installed: (none)
  Candidate: 24.x.x-1nodesource1
  Version table:
    24.x.x-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 nodejs

Verify the runtime and npm versions after the install finishes:

node --version
npm --version
v24.x.x
11.x.x

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 or python3 --version reports command not found, install the missing tools first:

sudo apt install curl python3

Resolve the latest NVM release tag, download that installer to a temporary file, then run it under your user account:

(
    set -e
    export NVM_DIR="$HOME/.nvm"
    NVM_VERSION="$(curl -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | python3 -c 'import json, sys; print(json.load(sys.stdin)["tag_name"])')"

    case "${NVM_VERSION}" in
        v[0-9]*.[0-9]*.[0-9]*)
            ;;
        *)
            printf 'Unexpected NVM release tag: %s\n' "${NVM_VERSION}" >&2
            false
            ;;
    esac

    nvm_install_script="$(mktemp)"
    trap 'rm -f "$nvm_install_script"' EXIT
    curl -fsSLo "$nvm_install_script" "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh"
    bash "$nvm_install_script"
)

The parentheses run the resolver, download, and temporary-file cleanup in a subshell, so the temporary error handling does not change your current terminal.

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

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

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 instead of the which command, which often returns nothing for shell functions. Open a new terminal if you prefer to let the installer-added Bash or Zsh profile lines load NVM automatically.

Install Node.js with NVM on Linux Mint

Install the latest LTS release through NVM:

nvm install --lts

NVM always installs the latest LTS release available at that moment. The 24.x.x and 11.x.x example output uses placeholders, so your terminal will show the current LTS point release and bundled npm version.

Downloading and installing node v24.x.x...
Now using node v24.x.x (npm v11.x.x)

Verify the active runtime:

node --version
npm --version
v24.x.x
11.x.x

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.x.x (npm v11.x.x)
default -> lts/* (-> v24.x.x *)

The quotes around lts/* matter in Zsh because an unquoted asterisk can be treated as a filename glob before NVM receives the alias.

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.x.x (npm v11.x.x)

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

Example output on Linux Mint 22.x:

v18.19.1
9.2.0

Linux Mint 21.x still reports v12.22.9 and 8.5.1 unless you switch to NodeSource or NVM.

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
NODE_ARCH="$(dpkg --print-architecture)"

case "${NODE_ARCH}" in
    amd64)
        printf '%s\n' \
        'Types: deb' \
        "URIs: https://deb.nodesource.com/node_${NODE_MAJOR}.x" \
        'Suites: nodistro' \
        'Components: main' \
        "Architectures: ${NODE_ARCH}" \
        '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
        ;;
    *)
        printf 'This NodeSource Linux Mint workflow expects APT architecture amd64. Your system reports %s.\n' "${NODE_ARCH}" >&2
        false
        ;;
esac

Confirm that APT still points at the NodeSource candidate:

apt-cache policy nodejs

Relevant output includes:

nodejs:
  Installed: 24.x.x-1nodesource1
  Candidate: 24.x.x-1nodesource1
  Version table:
 *** 24.x.x-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 and switching the current shell:

nvm install --lts
nvm use --lts
Now using node v24.x.x (npm v11.x.x)

Refresh the default alias if new terminals should follow the latest LTS line:

nvm alias default 'lts/*'
default -> lts/* (-> v24.x.x *)

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. Check whether the distro runtime and headers are still installed:

dpkg-query -W -f='${db:Status-Abbrev} ${Package} ${Version}\n' libnode-dev nodejs npm 2>/dev/null || true

If the old packages are installed, remove them first:

sudo apt remove --purge libnode-dev nodejs npm

Then run the cleanup step separately and review the apt autoremove list before accepting it:

sudo apt autoremove

Install the NodeSource package again after the conflicting files are gone:

sudo apt install nodejs

Verify the switch completed cleanly:

node --version
npm --version
v24.x.x
11.x.x

Fix Zsh No Matches Found for NVM LTS Alias

Zsh can stop an unquoted lts/* alias before NVM sees it because the shell treats the asterisk as a filename pattern. Quote the alias target when setting the default LTS line:

nvm alias default 'lts/*'

Confirm the alias points at the current LTS release:

nvm alias default

Relevant output includes:

default -> lts/* (-> v24.x.x *)

Fix NVM Version Not Available Errors on Linux Mint

If NVM says a specific Node.js version is not released or not available for download, the requested version is not in the release index NVM is using. List available LTS releases before retrying:

nvm ls-remote --lts

Choose only a version that appears in that list; NVM cannot install an unreleased patch version.

Install the latest LTS release when you do not need an exact patch version:

nvm install --lts
nvm use --lts

Retest the active runtime after NVM switches versions:

node --version

A successful retest prints the active LTS version, such as v24.x.x while Node.js 24 is the LTS branch.

If the project has a .nvmrc file, update it to a version listed by nvm ls-remote --lts instead of guessing a patch release.

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

Load the NVM shell function into the current terminal first:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

If new terminals still cannot see NVM, inspect the shell profiles that the installer can update:

grep -n 'NVM_DIR\|nvm.sh\|bash_completion' ~/.bashrc ~/.zshrc ~/.profile ~/.zprofile 2>/dev/null || true

The check should print at least one NVM initialization line. If it prints nothing, rerun the NVM installer command under your user account, then open a new terminal and retest.

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:

sudo apt remove --purge nodejs npm

Run the cleanup step separately and review the apt autoremove list before you accept it on a reused workstation:

sudo apt autoremove

Clean the user npm cache only if you no longer need cached packages for another Node.js install:

Deleting ~/.npm clears npm cache and package metadata for your user account. Keep it if another Node.js install or project still uses that cache.

rm -rf ~/.npm

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

apt-cache policy nodejs
hash -r
command -v node || printf 'node command not found\n'

Relevant output includes:

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
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 in the example output.

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 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.

Deleting ~/.npm clears npm cache and package metadata for your user account. Keep it if another Node.js install or project still uses that cache.

rm -rf ~/.npm

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

apt-cache policy nodejs
hash -r
command -v node || printf 'node command not found\n'

Relevant output includes:

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
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:

Deleting ~/.nvm removes every Node.js version installed through NVM for this user. Back up any scripts or local runtime files you still need before removing the directory.

if command -v nvm >/dev/null 2>&1; then
    nvm unload
fi
rm -rf ~/.nvm
hash -r

Remove ~/.npm only if you also want to clear npm cache and package metadata for that user:

Deleting ~/.npm clears npm cache and package metadata for your user account. Keep it if another Node.js install or project still uses that cache.

rm -rf ~/.npm

Use a read-only check to find the profile lines before editing your shell startup file:

grep -n 'NVM_DIR\|nvm.sh\|bash_completion' ~/.bashrc ~/.zshrc ~/.profile ~/.zprofile 2>/dev/null || true

After that, remove the NVM initialization lines from the profile file reported by the check, then open a new terminal. Verify that NVM is gone. command -v nvm should return no output. If NVM was your only Node.js install, the node command should fail in a clean shell; if you still keep the Linux Mint or NodeSource package, it falls back to that system binary instead.

command -v nvm
command -v node || printf 'node command not found\n'
node command not found

Conclusion

Node.js is now running on Linux Mint through the method that matches your project: the distro package for older workloads, NodeSource for one supported system runtime, or NVM for per-project switching. To finish the workstation setup, you can install VS Code on Linux Mint and point it at the runtime you just configured.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
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 coffeeBuy 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 in published comments:

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

Got a Question or Feedback?

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

Verify before posting: