Yarn

Install Yarn

brew install yarn

Switch yarn to specific version / latest version (yarn 1.x)

yarn policies set-version <version>
yarn policies set-version

Switch yarn to specific version / latest version (yarn 2.x)

yarn set version <version>
yarn set version latest

Information

Show yarn version and help

yarn -v
yarn help

Show information for a package

yarn info <package>

Show why a package was installed

yarn why <package>

List

List installed packages (local / global)

List only top level global packages

List packages that match pattern

Init

Initialize package config in current folder (-y or --yes for default setup)

Generate new yarn lock file from installed packages

Install

Install all configured package.json dependencies (dev and production)

Install new dev (-D), peer (-P), optional (-O) package

Global packages

Uninstall

Uninstall package (local, dev, global)

Upgrade

Upgrade packages or specific package (local, global) for current major

Upgrade packages or specific package to latest version regardless of package.json version ranges

Show outdated packages where new version exists

Scripts

Run scripts from package.json

Check

Check configured dependencies match lock file

Global Packages and Cache

Show location of global packages folder

Show direction of global cache

List all or matching packages in global cache

Clear the global cache

Configuration

Display the current configuration

Set configuration values

Get configuration value

Delete configuration value

Last updated