Yarn

Last updated: 2020-05-04

Installing Yarn

# npm install -g yarn
curl --compressed -o- -L https://yarnpkg.com/install.sh | bash

yarnpkg.com/en/docs/install

Test what packages are globally installed with Yarn:

yarn global list

Initialize a project

# May need sudo
yarn init

Install Dependencies

yarn
# or
yarn install

Add | Upgrade | Removed Dependencies

yarn add [package-name]
yarn add [package]@[version-or-tag]

# devDependencies
yarn add gulp --dev

To upgrade or remove a package, replace add with either upgrade or remove followed by the package name.

# upgrade to gulp version 4
yarn upgrade gulp@4.0

# remove gulp
yarn remove gulp

Yarn Lock File

yarn.lock file should be included in version control to maintain version consistency.

Remove Dependency Bloat

yarn clean

Update Yarn

yarn self-update

Resources