How to install Node 8 on Debain 9.4

Created by Jordy Leffers at 06-12-2017 11:05:35 +0100

Node.js is a server-sides open-source JavaScript run time environment. This means that, in contrast to JavaScript that runs its scripts client-sided, Node.js can run scripts on the server before the page is even sent to the client's browser.

This tutorial is based on cloud containers created on the page. This means that by default you are the root user, so all of the commands below don't make use of sudo. If however, you're not the root user on your system, you'll have to add "sudo" in front of the commands found in this guide below.


Installing Node.js

Debian does have Node.js in its package manager, but that version is most likely outdated, so using the following command we can add the correct repository.

curl -sL | bash -

Install Node.js:

apt-get install -y nodejs


Thereafter, we can check to see if the correct version of Node was installed:

node -v


Congratulations, you've now successfully installed Node.js!

The following steps are not necessary, but they'll help you installing additional packages (in the future).

Installing with NPM

NPM is a package manager for Node.js, but it also handles lots of other JavaScript packages.

Before, however, we start installing NPM we must first install two development packages, this will help prevent problems from coming up when NPM comes across a source package: 

apt install build-essential libssl-dev


Often used packages with NodeJS include packages like: Express, or body-parser.

You could install them with this command:

npm install express body-parser


Express is a framework for Node.js designed to build web applications and API's.

Body-parser is a middleware module that helps API's process incoming post requests.

Congratulations, you're now fully prepared to use Node.js!


Comments are turned off.