How To Install dh-nodejs on Debian 12

Learn how to install dh-nodejs on Debian 12 with this tutorial. dh-nodejs is debhelper addon to build Node.js modules

Introduction

In this tutorial we learn how to install dh-nodejs on Debian 12.

What is dh-nodejs

dh-nodejs is:

dh-nodejs provides debhelper files (set dh-sequence-nodejs into build dependencies) to automatically:

  • read lerna.conf “packages” field if exists and/or “workspaces” field from package.json
  • link or copy needed modules into node_modules/ directory
  • automatically build package and components when build system is recognized
  • launch test
  • choose files to install
  • build “Provides” value for package with components
  • build pkgjs-lock.json files and “XB-Javascript-Built-Using” value for packages built with webpack/browserify
  • clean all its stuff during dh_auto_clean step

There are three methods to install dh-nodejs on Debian 12. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install dh-nodejs Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install dh-nodejs using apt-get by running the following command:

sudo apt-get -y install dh-nodejs

Install dh-nodejs Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install dh-nodejs using apt by running the following command:

sudo apt -y install dh-nodejs

Install dh-nodejs Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install dh-nodejs using aptitude by running the following command:

sudo aptitude -y install dh-nodejs

How To Uninstall dh-nodejs on Debian 12

To uninstall only the dh-nodejs package we can use the following command:

sudo apt-get remove dh-nodejs

Uninstall dh-nodejs And Its Dependencies

To uninstall dh-nodejs and its dependencies that are no longer needed by Debian 12, we can use the command below:

sudo apt-get -y autoremove dh-nodejs

Remove dh-nodejs Configurations and Data

To remove dh-nodejs configuration and data from Debian 12 we can use the following command:

sudo apt-get -y purge dh-nodejs

Remove dh-nodejs configuration, data, and all of its dependencies

We can use the following command to remove dh-nodejs configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge dh-nodejs

Dependencies

dh-nodejs have the following dependencies:

References

Summary

In this tutorial we learn how to install dh-nodejs package on Debian 12 using different package management tools: apt, apt-get and aptitude.