Skip to content

Yarn Commands Cheat Sheet

Yarn Commands Cheat Sheet

Installation

yarn install

Install all 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 package and add it to devDependencies in package.json.

yarn add webpack --dev

Update

yarn upgrade [package]

Upgrade an installed package to the latest version.

yarn upgrade lodash

yarn upgrade [package]@[version]

Upgrade an installed package to a specific version.

yarn upgrade [email protected]

Remove

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