Skip to content

The two primary package managers for Node.js applications, including for JavaScript/TypeScript are NPM and Yarn. Additions to the Plug 'n' Play strategy have yielded current state-of-the-art package managers

Using (P)NPM

Note that I will be using the npm but pnpm can be used as a direct replacement for this command. Many people set the alias npm=pnpm To install Node Package Manager (NPM) on Ubuntu/Debian use

sh
sudo apt install npm nodejs
sudo apt install npm nodejs

To change versions, install Node Version Manager (NVM) with the following install script

sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Then change version with

sh
nvm install 14
nvm use 14
nvm -v
nvm install 14
nvm use 14
nvm -v

Using Yarn

Install Yarn through NPM.

sh
npm install --global yarn
npm install --global yarn