How to install Node.js & NPM on Debian 11?
apt for a quick setup, via the NodeSource repository for a current LTS version, or via NVM to manage multiple Node.js versions. Running sudo apt update && sudo apt install nodejs npm -y installs both Node.js and npm together in under a minute – though for production servers, the NodeSource method below is recommended since Debian’s default repo ships an outdated version.Introduction
Node.js is open-source and cross-platform JavaScript runtime environment which is built on Chrome’s V8 JavaScript engine. It features non-blocking, event-driven servers which are mainly used for back-end API services and traditional websites.
This blog explains three ways to install Node.js and npm on a Debian 11 server.
What You Need Before Installing Node.js on Debian 11
Before we begin to install, make sure these requirements are met:
- Debian 11 VPS
- Access to the root user account (or access to an admin account with root privileges)
How to Install Node.js and npm on Debian 11 Using apt
1. To install NodeJS and NPM on Debian 11, run the apt install command below.
sudo apt install nodejs npm -y
2. To verify if NodeJS and NPM are installed correctly, run the below commands.
node -v v12.22.5 npm -v 7.5.2
Installation of NodeJS with PPA
PPA is another repository for software packages. It offers software that is not available in the official Debian 11 repositories.
1. Add the PPA repository to the system by using the below command. and replace setup_17.x with the updated version of NodeJS.
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash - ## Installing the NodeSource Node.js 17.x repo... ## Populating apt-get cache... ## Creating apt sources list file for the NodeSource Node.js 17.x repo...
2. Update the source lists, to add the new repository that was recently added with the below command.
sudo apt update -y
3. Then, install NodeJS and NPM using the following command.
sudo apt install nodejs -y
4. Check if NodeJS and NPM are installed correctly using the below commands.
node -v v17.4.0 $ npm -v 8.3.1
How to Install Node.js on Debian 11 Using NVM
Node Version Manager(NVM) is a bash script. It is used to maintain multiple active NodeJS versions on the same machine. Through this method multiple versions of NodeJS can be used.
1. Download the installer script from GitHub.
curl https://raw.githubusercontent.com/creationix/nvm/master/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
2. To reload the environment variables in the current session, run the below command
source ~/.profile
3. List the available versions of NodeJS.
nvm ls-remote
4. Once the version is finalized, run the below command to download and install nvm install <version>:
nvm install 11.6 Downloading and installing node v11.6.0... Downloading https://nodejs.org/dist/v11.6.0/node-v11.6.0-linux-x64.tar.xz... Computing checksum with sha256sum Checksums matched! Now using node v11.6.0 (npm v6.5.0-next.0)
5. Run the below command to list the installed NodeJS versions. NNM indicates the version that is the default.
Installation of NodeJS is successful. You can use the node command to run NodeJS apps within any of these installed versions and switch between the NodeJS versions using NVM.
Conclusion
All three methods successfully install Node.js and npm, but the right one depends on your use case. Use apt only for quick testing, since it installs an outdated version. Use the NodeSource repository for production servers that need a specific, current LTS version. Use NVM if you’re developing across multiple projects that require different Node.js versions.
Keep in mind that Debian 11 itself reached end-of-life on August 31, 2026 — for new deployments, consider setting up Node.js on Debian 12 or 13 instead. If you’re running Node.js applications on a Cantech Linux Dedicated Server or Cloud VPS Hosting , our team can help you choose and configure the right setup for your workload.
FAQs
What’s the easiest way to install Node.js on Debian 11?
The fastest way is sudo apt install nodejs npm -y, though this installs an outdated version (v12.x). For a current LTS version, use the NodeSource method, or NVM if you need to manage multiple versions.
How do I install npm on Debian 11?
npm is bundled with Node.js in Debian’s apt repository, so sudo apt install nodejs npm -y installs both together. Verify with npm -v. If you need a newer npm version, install Node.js via NodeSource or NVM instead, which ship more current npm releases.
How do I install Node.js on Debian 11 using apt?
Run sudo apt update followed by sudo apt install nodejs npm -y, then confirm the install with node -v. This is the quickest method but installs Debian’s older packaged version rather than a current Node.js release.
What’s the difference between installing Node.js via apt, NodeSource, and NVM?
apt is fastest but installs an old, unmaintained version. NodeSource gives you a specific current version system-wide but requires re-running the setup script to upgrade. NVM lets you install and switch between multiple Node.js versions per-user, making it best for development machines.
How do I fix npm permission errors (EACCES) on Debian 11?
This typically happens when npm’s global directory is owned by root. Avoid using sudo with npm install; instead, reconfigure npm to use a directory in your home folder, or switch to NVM, which avoids the issue entirely since it installs Node.js per-user.
Is Debian 11 still supported in 2026?
No. Debian 11 (Bullseye) reached end-of-life on August 31, 2026, when its Long Term Support window closed, and it no longer receives official security patches. Freexian offers commercial Extended LTS through mid-2031 for a limited package set, but upgrading to Debian 12 or 13 is recommended before installing Node.js on a new server.
For more latest information and updates refer to these official pages: NodeJS documentation, NodeJS GitHub page, NodeSource documentation page, NPM documentation.