Install Node.js, npm and Yarn

node.js logo

Normally, it is recommended to install the latest even-numbered LTS of Node.js, which from 2020-10-27 is 14.14.0 and includes npm 6.14.8.

https://github.com/nodesource/distributions/blob/master/README.md#debinstall

Install Node.js v14.x

$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Versions (note, use node, no longer nodejs)

$ node -v
v14.14.0

$ npm -v
6.14.8

To prevent "npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'" errors, follow these instructions, to resolve EACCES permissions errors when installing packages globally:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

Install stable version of Yarn

Follow the directions on the official Yarn installation page: https://yarnpkg.com/lang/en/docs/install/#debian-stable

$ yarn -v
1.22.5