How to Install Node.js on Debian 13

Node.js is an open source server environment. Node.js allows you to run JavaScript on the server.

Install via APT Package Manager

Install stable nodejs from the Debian repository by running the following command.

apt install nodejs

Output:

root@server:~# apt install nodejs
Installing:                     
  nodejs

Installing dependencies:
  libcares2  libnode115  node-balanced-match   node-cjs-module-lexer  node-minimatch  node-xtend
  libicu76   node-acorn  node-brace-expansion  node-corepack          node-undici     nodejs-doc

Suggested packages:
  npm

Summary:
  Upgrading: 0, Installing: 13, Removing: 0, Not Upgrading: 0
  Download size: 29.6 MB
  Space needed: 123 MB / 92.8 GB available

Then check the version of the nodejs once the installation is done.

node --version

Output:

root@server:~# node --version
v20.19.2

Installing a different version of Node.js from source

For this, we will take help of nvm manager. To get the latest version of the nvm, visit their github repository.

Download the install.sh script and run it using the below command,

root@server:~# wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

Output:

root@server:~# wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
=> Downloading nvm as script to '/root/.nvm'

=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Update your shell ~/.profile by running following command

source ~/.profile

Next, Check if NVM is installed or not by checking for its version.

nvm --version

Output:

root@server:~# nvm --version
0.40.3

List out all available Node.js versions. you can see all Node.js versions from the first version to the latest version.

nvm ls-remote

Output:

root@server:~# nvm ls-remote
        v0.1.14
        v0.1.15
        v0.1.16
        v0.1.17
        v0.1.18
        v0.1.19
        v0.1.20
        v0.1.21
        v0.1.22
        v0.1.23
        v0.1.24
        v0.1.25
        v0.1.26
        v0.1.27
        v0.1.28
        v0.1.29
        ...
       v22.18.0   (Latest LTS: Jod)
        v23.0.0
        v23.1.0
        v23.2.0
        v23.3.0
        v23.4.0
        v23.5.0
        v23.6.0
        v23.6.1
        v23.7.0
        v23.8.0
        v23.9.0
       v23.10.0
       v23.11.0
       v23.11.1
        v24.0.0
        v24.0.1
        v24.0.2
        v24.1.0
        v24.2.0
        v24.3.0
        v24.4.0
        v24.4.1
        v24.5.0

Now install Node.js with the version you want by running "nvm install" command.

eg: Here 24.5.0 (the very latest version of node.js available at the time of writing this article)

root@server:~# nvm install v24.5.0

Output:

root@server:~# nvm install v24.5.0
Downloading and installing node v24.5.0...
Downloading https://nodejs.org/dist/v24.5.0/node-v24.5.0-linux-x64.tar.xz...
###################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v24.5.0 (npm v11.5.1)
Creating default alias: default -> v24.5.0

Now check the version of the nodejs once the installation is done.

root@server:~# node -v

Output:

root@server:~# node -v
v24.5.0

This concludes the topic of installing Node.js on a Debian 13 system. Using two different ways, apt and nvm package managers.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS