Skip to main content

Yarn CheatSheet for Developers

Basic Syntax of Yarn

CommandDescription
yarnInstall dependencies
yarn add [package]Install package
yarn add --dev [package]Install dev package
yarn autocleanFrees up unnecessary files and folders from dependencies
yarn cache cleanRemove the shared cache files
yarn global add [package]Global install package
yarn global remove [package]Global uninstall package
yarn helpAccessing the list of commands
yarn infoSee information related to packages
yarn initCreate a new package
yarn link <destination>Connect the local project to another one
yarn npm loginStore new login info to access the npm registry
yarn npm logoutLogout of the npm registry
yarn npm publishPublish the active workspace to the npm registry
yarn packGenerate a tarball from the active workspace
yarn remove [package]Uninstall package
yarn remove [package]Uninstall dev package
yarn run <scriptName>Run a script defined in the package.json
yarn set version <version>Lock the Yarn version used by the project
yarn up [package]Upgrade dependencies across the project
yarn upgradeUpdated
yarn upgrade [package]Update package