Blog

Installing Node.js on Debian: A Quick Guide for Developers

Getting Node.js v14.x running on Debian Sid or Unstable takes only a few minutes, thanks to a community-maintained installer that handles the repository setup automatically. The NodeSource script adds the required package source, configures signing keys, and cleans up any previous NodeSource installations in a single command. Whether you are starting fresh or upgrading from an older release, the workflow remains the same.

Before You Begin

The installation script requires curl to download and execute properly. Update your system packages first to synchronize everything. If you are running inside a Docker container, skipping this step typically results in errors because the curl package cannot be found.

Install curl with the following command:

Su -c 'apt install -y curl'

Installing Node.js v14.x

NodeSource maintains an installation script that automates the entire repository setup. Run this single command to download and execute it:

Su -c 'curl -sL https://deb.nodesource.com/setup_14.x | bash -'

The script will take a moment to add the new repository, set up the necessary signing keys, and remove any older NodeSource repositories that might be present.

After the script finishes, run your package update again to ensure your system has fully synchronized with the new repository. Some users report issues because they skip this step when something goes wrong during the initial script run.

With everything updated, install Node.js with this command:

Su -c 'apt install -y nodejs'

If you already have a previous version of Node.js on your system, whether it came from the default Debian repositories or an earlier NodeSource setup, this command handles the upgrade automatically. No separate removal steps are required.

Verifying Your Installation

Once the installation completes, confirm that everything is working as expected. Run the version command to see which release is now active on your system:

Node -v

Seeing a v14.x version number means you are ready to go. If you encounter any errors, double-check that the curl installation succeeded and that your package index was properly updated before running the NodeSource script again.

Who Should Care

This guide is useful if you match one or more of the following criteria:

  • You run Debian Sid (Unstable) or Debian Testing
  • You need Node.js v14.x specifically
  • You prefer using community-maintained installation scripts over adding repositories manually
  • You are upgrading from an older NodeSource installation
  • You want a single command that handles both fresh installs and upgrades

If you are on a stable Debian release or need a different Node.js version, look for the appropriate NodeSource setup script (such as setup_16.x, setup_18.x, or setup_20.x) that matches your requirements.

Bottom Line

Getting Node.js v14.x running on Debian Sid is straightforward thanks to the NodeSource installation script. Install curl, run the setup command, update your packages, and install nodejs. Verify with a quick version check and you are done.

Key takeaways

  • Install curl first to avoid package-not-found errors during setup
  • The NodeSource script automates repository configuration and cleans up old installations
  • The same apt install command handles both fresh installations and upgrades from previous Node.js versions
  • Running the package update twice ensures complete synchronization and catches errors early
  • Debian Sid is the unstable branch; this setup is best suited for development and testing environments

Frequently asked questions

What version of Node.js does this guide install?

This guide covers installing Node.js v14.x, which includes the eventual LTS release in that series.

Can I use this method to upgrade from an older Node.js version?

Yes. Running the apt install command will upgrade any existing Node.js installation, whether it came from Debian repositories or an earlier NodeSource setup.

Why is updating packages twice recommended?

The NodeSource script synchronizes your package index, but running the update again ensures everything is fully synchronized and helps catch any errors that occurred during the initial setup.

What if I run this inside a Docker container?

You must update your system packages first. Skipping this step typically results in errors because the curl package cannot be found during installation.

Is this method safe for production systems?

Debian Sid is the unstable branch, so this setup is best suited for development and testing environments rather than production servers.

Related