Skip to content

Yarn Command Cheat Sheet

Yarn Command Cheat Sheet

Installation

yarn install

Install all the dependencies listed in package.json.

yarn install

yarn add [package]

Install a new package and add it to dependencies in package.json.

yarn add lodash

yarn add [package] –dev

Install a development environment package and add it to devDependencies in package.json.

yarn add webpack --dev

Update

yarn upgrade [package]

Upgrade an installed package to its latest version.

yarn upgrade lodash

yarn upgrade [package]@[version]

Upgrade an installed package to a specific version.

yarn upgrade lodash@4.17.21

Removal

yarn remove [package]

Remove a package from the project and delete the corresponding record from package.json.

yarn remove lodash

Others

yarn cache clean

Clear Yarn’s cache.

yarn cache clean

yarn global add [package]

Install a global package.

yarn global add create-react-app