How to Install NodeJs
Posted Apr 10, 2020 01:26 PM
This tutorial does not include Windows instructions. This tutorial will be written using GNU/Linux (Debian)What is Node.js?
Node.js is a way to create javascript network applications. A lot of major frameworks are built around Node.js, which is why I am creating this tutorial.
What is NPM?
NPM stands for Node Package Manager. It's basically a way to share your javascript apps and code with other people. It's a repository for code. Many widely used web applications use npm as a way to let other people install their software. It's kind of like aptitude for debian or RPM for redhat.
How to Download and Install Node.js
You can download v12.16 (13mb) from this link, https://nodejs.org/dist/v12.16.1/node-v1...x64.tar.xz or you can use the aptitude package manager. The command below will install Node.js and npm without prompting. The install could take a while depending on your connection speed, so go grab some coffee.
Code
sudo apt install -y nodejs npmNow, check the version that installed.
Code
(xenial)sunjester@localhost:/var/www/html$ nodejs -v
v4.2.6Nodejs v4 is installed, but I want a more updated version, I want to use v12. We can use the PPA from NodeSource to get that version. Below is a curl request to get version 12 from NodeSource.
Code
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.shThen you can run the installer script using bash
Code
sudo bash nodesource_setup.shOnce the install is complete you will be able to install nodejs v12 (17mb) via aptitude
Code
sudo apt install -y nodejsand now you should have your updated nodejs installed
Code
(xenial)sunjester@localhost:~/Downloads$ nodejs -v
v12.16.1Build Essentials
Some projects require that you compile apps from their source, for that you will need the build-essential lib. If you followed this guide, then you should already have it installed but for those that don't, run the following command.
Code
sudo apt install -y build-essential



https://github.com/nvm-sh/nvm