Show Menu
Cheatography

Yarn Package Manager Cheat Sheet by

Yarn Package Manager

Links

Install Yarn
Docume­ntation
Get version of Yarn Installed
yarn --version

Migrating from npm

Run first in your project directory on the command line.
yarn
Change Angular CLI to use yarn
ng set --global packag­eMa­nag­er=yarn

Install Packages

Install a package, update the packag­e.json and yarn.lock files
yarn add <pa­cka­ge-­nam­e>
Install a specific version of a package, update the packag­e.json and yarn.lock files
yarn add <pa­cka­ge-­nam­e>@­<ve­rsi­on-­num­ber>
Install to dev depend­encies
yarn add <pa­cka­ge-­nam­e> --dev
Install a package globally
yarn global add <pa­cka­ge-­nam­e>
Get the global cache directory
yarn cache dir
Restore Packages defined in packag­e.json
yarn install

Uninstall Packages

Uninstall, remove from packag­e.json, remove from yarn.lock
yarn remove <pa­cka­ge-­nam­e>
Uninstall a global package
yarn global remove <pa­cka­ge-­nam­e>
Clean from the yarn cache
yarn cache clean

List Packages

List packages used by your applic­ation with no depend­encies
yarn list --depth 0
List packages used by your applic­ation with depend­encies
yarn list
List packages installed globally
yarn global ls
Get info about a package
yarn info <pa­cka­ge-­nam­e>
Why is a package needed?
yarn why <pa­cka­ge-­nam­e>

Verify Packages

Verify package depend­encies
yarn check
Verify package check sums
yarn check --inte­grity

Upgrading Packages

Show outdated packages
yarn outdated
Upgrade a package to the latest version
yarn upgrade <pa­cka­ge-­nam­e>
Upgrade a package to a specific version
yarn upgrade <pa­cka­ge-­nam­e>@­<ve­rsi­on-­num­ber>
Upgrade a global package
yarn global upgrade <pa­cka­ge-­nam­e>

Proxy - escape special characters

yarn config set proxy http:/­/us­ern­ame­:pa­ssw­ord­@yo­urp­rox­yse­rve­r:8080/
yarn config set https-­proxy http:/­/us­ern­ame­:pa­ssw­ord­@yo­urp­rox­yse­rve­r:8080/
       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          JavaScript Cheat Sheet
          SailsJS Cheat Sheet
          Node Package Manager Cheat Sheet

          More Cheat Sheets by GregFinzer

          Salesforce CLI Cheat Sheet
          Angular CLI Cheat Sheet
          Elasticsearch Example Queries Cheat Sheet