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
- PNPM: An stand-in NPM replacement (my personal favourite).
- Yarn 2 (with Plug 'n' Play): The second generation of the awesome Yarn package manager.
Using (P)NPM
Note that I will be using the
npmbutpnpmcan be used as a direct replacement for this command. Many people set thealias npm=pnpmTo install Node Package Manager (NPM) on Ubuntu/Debian use
sh
sudo apt install npm nodejssudo apt install npm nodejsTo 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 | bashcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashThen change version with
sh
nvm install 14
nvm use 14
nvm -vnvm install 14
nvm use 14
nvm -vUsing Yarn
Install Yarn through NPM.
sh
npm install --global yarnnpm install --global yarn