How To Install nodejs-legacy on Debian 9

In this tutorial we learn how to install nodejs-legacy on Debian 9. nodejs-legacy is evented I/O for V8 javascript (legacy symlink)

Introduction

In this tutorial we learn how to install nodejs-legacy on Debian 9.

What is nodejs-legacy

nodejs-legacy is:

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

This package contains a symlink for legacy Node.js code requiring binary to be /usr/bin/node (not /usr/bin/nodejs as provided in Debian).

No other Debian packages should depend on this package. For more information, see http://lists.debian.org/debian-devel-announce/2012/07/msg00002.html

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

Install nodejs-legacy Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install nodejs-legacy

Install nodejs-legacy Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install nodejs-legacy

Install nodejs-legacy 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 nodejs-legacy using aptitude by running the following command:

sudo aptitude -y install nodejs-legacy

How To Uninstall nodejs-legacy on Debian 9

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

sudo apt-get remove nodejs-legacy

Uninstall nodejs-legacy And Its Dependencies

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

sudo apt-get -y autoremove nodejs-legacy

Remove nodejs-legacy Configurations and Data

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

sudo apt-get -y purge nodejs-legacy

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

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

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

Dependencies

nodejs-legacy have the following dependencies:

References

Summary

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