Node.js was developed to run JavaScript everywhere (as opposed to solely in a web browser) which led to the development of a lot of software written in JavaScript (arguably the most popular programming language, see the survey by StackOverflow and the RedMonk’s one). I personally use several pieces of it, for instance gtop and decktape and I install them with the dedicated package manager, namely npm.
A few days ago, I had a hard time installing decktape — that I use to convert my HTML presentations to pdf files — on my Debian Buster computer, and so I decided to do a fresh install of Node.js and npm. Fortunately, the topic is well covered online, especially in a very clear article posted on Linuxize which was very helpful. In a nutshell, there are two simple ways for this installation:
- using the Debian package manager;
- using NVM (Node Version Manager).
The first option is rather straightforward:
|
|
Note that on Debian Buster, you will have the following version installed:
$ npm -v
5.8.0
$ node -v
v10.15.2
The second option requires to run a small command line
|
|
which installs Node.js, npm and the following lines to .bashsrc
:
|
|
As I use zsh
, I cut and pasted this to my .zprofile
. I read somewhere that
it is better to use NVM (cannot find where anymore) but I don’t understand why
this would be true except to get the latest version of nodejs and npm. And this is why I
decided to use NVM (Node Version Manager). Once installed I checked where were the corresponding binary and the versions:
|
|
I then installed decktape
and gtop
:
|
|
it worked pretty well! And the commands are also installed in ~/.nvm
💥.
|
|
During this process, I figured that I was able to have two versions installed,
one installed via apt-get
and the other by NVM and so, while I have v13.0.1 installed via NVM, I also had v10.13.0.
|
|
Seemed like this was not a problem but I thought the sane piece of software installed twice at different locations with different versions wasn’t the best thing to do and so I removed v10.13.0. I may change this in the future if I use nodejs for other Debian packages, in which case I will write a follow up to this note 😄!